diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/config/Config.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/config/Config.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/cuchaz/enigma/config/Config.java b/src/main/java/cuchaz/enigma/config/Config.java index 87ef353..75ced70 100644 --- a/src/main/java/cuchaz/enigma/config/Config.java +++ b/src/main/java/cuchaz/enigma/config/Config.java | |||
| @@ -62,7 +62,7 @@ public class Config { | |||
| 62 | public void loadConfig() throws IOException { | 62 | public void loadConfig() throws IOException { |
| 63 | if (!ENIGMA_DIR.exists()) ENIGMA_DIR.mkdirs(); | 63 | if (!ENIGMA_DIR.exists()) ENIGMA_DIR.mkdirs(); |
| 64 | File configFile = new File(ENIGMA_DIR, "config.json"); | 64 | File configFile = new File(ENIGMA_DIR, "config.json"); |
| 65 | if (configFile.exists()) gson.fromJson(Files.toString(configFile, Charset.defaultCharset()), Config.class); | 65 | if (configFile.exists()) gson.fromJson(Files.asCharSource(configFile, Charset.defaultCharset()).read(), Config.class); |
| 66 | else { | 66 | else { |
| 67 | this.reset(); | 67 | this.reset(); |
| 68 | Files.touch(configFile); | 68 | Files.touch(configFile); |
| @@ -71,7 +71,7 @@ public class Config { | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | public void saveConfig() throws IOException { | 73 | public void saveConfig() throws IOException { |
| 74 | Files.write(gson.toJson(this), CONFIG_FILE, Charset.defaultCharset()); | 74 | Files.asCharSink(CONFIG_FILE, Charset.defaultCharset()).write(gson.toJson(this)); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | public void reset() throws IOException { | 77 | public void reset() throws IOException { |