annotate src/name/blackcap/imageprep/Settings.kt @ 15:fad32eda667f

Fix ImageWriter leak.
author David Barts <n5jrn@me.com>
date Sun, 19 Jul 2020 13:49:23 -0700
parents 884f1415a330
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
1 /*
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
2 * Our settings. Basically just some parsed properties.
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
3 */
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
4 package name.blackcap.imageprep
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
5
1
0bded24f746e Compiles, still untested.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
6 import java.io.File
0bded24f746e Compiles, still untested.
David Barts <n5jrn@me.com>
parents: 0
diff changeset
7
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
8 /* work around name shadowing */
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
9 private val _PROPS = PROPERTIES
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
10
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
11 object Settings {
4
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
12 var maxDimension = _PROPS.getProperty("maxDimension").toInt()
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
13 var outputQuality = _PROPS.getProperty("outputQuality").toInt()
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
14 var outputSuffix = _PROPS.getProperty("outputSuffix")
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
15 var outputTo = tilde(_PROPS.getProperty("outputTo"))
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 2
diff changeset
16 var outputToInputDir = strToBool(_PROPS.getProperty("outputToInputDir"))
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
17
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
18 private fun strToBool(s: String): Boolean {
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
19 if (s.isNullOrEmpty())
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
20 return false
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
21 val c1 = s[0].toLowerCase()
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
22 return c1 == 't' || c1 == 'y'
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
23 }
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
24 }