view src/name/blackcap/imageprep/Settings.kt @ 9:9e9fe34052a6

Use .close().
author David Barts <n5jrn@me.com>
date Fri, 17 Jul 2020 23:13:13 -0700
parents 884f1415a330
children
line wrap: on
line source

/*
 * Our settings. Basically just some parsed properties.
 */
package name.blackcap.imageprep

import java.io.File

/* work around name shadowing */
private val _PROPS = PROPERTIES

object Settings {
    var maxDimension = _PROPS.getProperty("maxDimension").toInt()
    var outputQuality = _PROPS.getProperty("outputQuality").toInt()
    var outputSuffix = _PROPS.getProperty("outputSuffix")
    var outputTo = tilde(_PROPS.getProperty("outputTo"))
    var outputToInputDir = strToBool(_PROPS.getProperty("outputToInputDir"))

    private fun strToBool(s: String): Boolean {
        if (s.isNullOrEmpty())
            return false
        val c1 = s[0].toLowerCase()
        return c1 == 't' || c1 == 'y'
    }
}