diff options
Diffstat (limited to 'src/app/main.js')
-rw-r--r-- | src/app/main.js | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/app/main.js b/src/app/main.js index 51d9e73..4eae3ec 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -2,6 +2,8 @@ const fs = require("fs"); const path = require("path"); const { app, ipcRenderer, shell } = require("electron"); +const json = require("../modules/json"); + const lang = require("../lang"); var modsobj = { all: [], @@ -33,25 +35,11 @@ ipcRenderer.send("setlang", settings.lang); // Loads the settings if (fs.existsSync("viper.json")) { - let conf = fs.readFileSync("viper.json", "utf8"); - let json = {}; - - // Validates viper.json - try { - json = JSON.parse(conf); - }catch (e) { - let reset = confirm(lang("general.invalidconfig", navigator.language) + e); - if (! reset) { - ipcRenderer.send("exit"); - } else { - fs.rmSync("viper.json"); - ipcRenderer.send("relaunch"); - } - + settings = { + ...settings, + ...json("viper.json") || {} } - settings = {...settings, ...json}; - if (settings.gamepath.length === 0) { setpath(false); } else { |