Mercurial > cgi-bin > hgweb.cgi > ClipMan
comparison src/name/blackcap/clipman/Files.kt @ 41:33fbe3a78d84
Got the settings stuff compiling (untested).
author | David Barts <n5jrn@me.com> |
---|---|
date | Sat, 08 Feb 2020 22:10:01 -0700 |
parents | be282c48010a |
children | d14298ef8b0a |
comparison
equal
deleted
inserted
replaced
40:c803a2c89ea0 | 41:33fbe3a78d84 |
---|---|
4 */ | 4 */ |
5 package name.blackcap.clipman | 5 package name.blackcap.clipman |
6 | 6 |
7 import java.io.BufferedReader | 7 import java.io.BufferedReader |
8 import java.io.File | 8 import java.io.File |
9 import java.io.FileReader | 9 import java.io.FileInputStream |
10 import java.io.InputStreamReader | |
10 import java.util.Properties | 11 import java.util.Properties |
11 import java.util.logging.FileHandler | 12 import java.util.logging.FileHandler |
12 import java.util.logging.Level | 13 import java.util.logging.Level |
13 import java.util.logging.Logger | 14 import java.util.logging.Logger |
14 import java.util.logging.SimpleFormatter | 15 import java.util.logging.SimpleFormatter |
60 | 61 |
61 private fun File.makeIfNeeded() = if (exists()) { true } else { mkdirs() } | 62 private fun File.makeIfNeeded() = if (exists()) { true } else { mkdirs() } |
62 | 63 |
63 /* make some usable objects */ | 64 /* make some usable objects */ |
64 | 65 |
65 val PROPERTIES = run { | 66 val DPROPERTIES = Properties().apply { |
67 OS::class.java.getClassLoader().getResourceAsStream("default.properties").use { load(it) } | |
68 } | |
69 | |
70 val PROPERTIES = Properties(DPROPERTIES).apply { | |
66 PF_DIR.makeIfNeeded() | 71 PF_DIR.makeIfNeeded() |
67 PROP_FILE.createNewFile() | 72 PROP_FILE.createNewFile() |
68 Properties().apply { | 73 BufferedReader(InputStreamReader(FileInputStream(PROP_FILE), CHARSET)).use { |
69 BufferedReader(FileReader(PROP_FILE)).use { load(it) } | 74 load(it) |
70 } | 75 } |
71 } | 76 } |
72 | 77 |
73 val LOGGER = run { | 78 val LOGGER = run { |
74 LF_DIR.makeIfNeeded() | 79 LF_DIR.makeIfNeeded() |