summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/config/KBackupConfig.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/config/KBackupConfig.java b/src/main/java/com/keuin/kbackupfabric/config/KBackupConfig.java
index 8ece8d2..8ce5ed4 100644
--- a/src/main/java/com/keuin/kbackupfabric/config/KBackupConfig.java
+++ b/src/main/java/com/keuin/kbackupfabric/config/KBackupConfig.java
@@ -1,6 +1,7 @@
package com.keuin.kbackupfabric.config;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.keuin.kbackupfabric.util.PrintUtil;
@@ -25,20 +26,24 @@ public class KBackupConfig {
return new KBackupConfig(false);
}
- public static void load() throws IOException {
- File file = new File(CONFIG_FILE);
+ public static void load(File file) throws IOException {
ObjectMapper om = new ObjectMapper();
+ om.enable(JsonParser.Feature.ALLOW_COMMENTS);
try {
instance = om.readValue(file, KBackupConfig.class);
} catch (FileNotFoundException ignored) {
// generate default config file
- PrintUtil.info("Config file does not exist. Creating default config: " + CONFIG_FILE);
+ PrintUtil.info("Config file does not exist. Creating default config: " + file.getAbsolutePath());
instance = getDefault();
ObjectWriter w = om.writerWithDefaultPrettyPrinter();
w.writeValue(file, instance);
}
}
+ public static void load() throws IOException {
+ load(new File(CONFIG_FILE));
+ }
+
public KBackupConfig() {
}