aboutsummaryrefslogtreecommitdiff
path: root/src/modules/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/settings.js')
-rw-r--r--src/modules/settings.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/modules/settings.js b/src/modules/settings.js
index a24f1e0..d0a2db1 100644
--- a/src/modules/settings.js
+++ b/src/modules/settings.js
@@ -2,6 +2,7 @@ const fs = require("fs");
const path = require("path");
const app = require("electron").app;
+const json = require("./json");
const lang = require("../lang");
var invalid_settings = false;
@@ -28,17 +29,14 @@ var settings = {
// Creates the settings file with the base settings if it doesn't exist.
if (fs.existsSync("viper.json")) {
- let conf = fs.readFileSync("viper.json", "utf8");
- let json = "{}";
+ let conf = json("viper.json");
// Validates viper.json
- try {
- json = JSON.parse(conf);
- }catch (e) {
+ if (! conf) {
invalid_settings = true;
}
- settings = {...settings, ...json};
+ settings = {...settings, ...conf};
settings.zip = path.join(settings.gamepath + "/northstar.zip");
let args = path.join(settings.gamepath, "ns_startup_args.txt");