diff 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
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Files.kt	Wed Feb 05 16:47:25 2020 -0800
+++ b/src/name/blackcap/clipman/Files.kt	Sat Feb 08 22:10:01 2020 -0700
@@ -6,7 +6,8 @@
 
 import java.io.BufferedReader
 import java.io.File
-import java.io.FileReader
+import java.io.FileInputStream
+import java.io.InputStreamReader
 import java.util.Properties
 import java.util.logging.FileHandler
 import java.util.logging.Level
@@ -62,11 +63,15 @@
 
 /* make some usable objects */
 
-val PROPERTIES = run {
+val DPROPERTIES = Properties().apply {
+    OS::class.java.getClassLoader().getResourceAsStream("default.properties").use { load(it) }
+}
+
+val PROPERTIES = Properties(DPROPERTIES).apply {
     PF_DIR.makeIfNeeded()
     PROP_FILE.createNewFile()
-    Properties().apply {
-        BufferedReader(FileReader(PROP_FILE)).use { load(it) }
+    BufferedReader(InputStreamReader(FileInputStream(PROP_FILE), CHARSET)).use  {
+        load(it)
     }
 }