view src/name/blackcap/imageprep/Settings.kt @ 7:801cdc780ca8

Work around ImageIO bug.
author David Barts <n5jrn@me.com>
date Fri, 17 Jul 2020 19:56:25 -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'
    }
}