writing config to disk

This commit is contained in:
minjaesong
2021-09-19 15:15:42 +09:00
parent b741d463bb
commit 66e77e0a01
8 changed files with 76 additions and 6 deletions

View File

@@ -297,6 +297,7 @@ public class App implements ApplicationListener {
// load configs
getDefaultDirectory();
createDirs();
initialiseConfig();
readConfigJson();
updateListOfSavegames();
@@ -988,7 +989,7 @@ public class App implements ApplicationListener {
// CONFIG //
private static KVHashMap gameConfig = new KVHashMap();
public static KVHashMap gameConfig = new KVHashMap();
private static void createConfigJson() throws IOException {
File configFile = new File(configDir);
@@ -998,6 +999,15 @@ public class App implements ApplicationListener {
}
}
/**
* Reads DefaultConfig to populate the gameConfig
*/
private static void initialiseConfig() {
for (Map.Entry<String, Object> entry : DefaultConfig.INSTANCE.getHashMap().entrySet()) {
gameConfig.set(entry.getKey(), entry.getValue());
}
}
/**
*
* @return true on successful, false on failure.