aboutsummaryrefslogtreecommitdiff
path: root/src/app/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/main.js')
-rw-r--r--src/app/main.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 70d1b0c..95b6f4c 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -27,7 +27,24 @@ ipcRenderer.send("setlang", settings.lang);
// Loads the settings
if (fs.existsSync("viper.json")) {
- settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))};
+ 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.writeFileSync("viper.json", "{}")
+ ipcRenderer.send("relaunch");
+ }
+
+ }
+
+ settings = {...settings, ...json};
settings.zip = path.join(settings.gamepath + "/northstar.zip");
if (settings.gamepath.length === 0) {