From 4936917f1ee64c89d5443d824d828e8f537154a5 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Wed, 13 Sep 2023 18:22:38 +0200 Subject: fixed settings file refusing to save if invalid This is quite counter intuitive, as, if it's invalid, how do we re-validate it, if we can't even save it again. This existed here because the idea was for the re-validation to occur somewhere else, and to make sure incorrectly formatted data wasn't being given to this function. Now the function simply resets the config, a restart may be required to add missing settings, in case the parsed `conf` doesn't have all keys. --- src/modules/settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/settings.js b/src/modules/settings.js index e1f68c6..94f6414 100644 --- a/src/modules/settings.js +++ b/src/modules/settings.js @@ -61,7 +61,7 @@ if (fs.existsSync("viper.json")) { settings.save = (obj = {}, notify_renderer = true) => { // refuse to save if settings aren't valid if (invalid_settings) { - return false; + settings = {}; } let settings_content = { @@ -86,7 +86,7 @@ settings.save = (obj = {}, notify_renderer = true) => { if (fs.existsSync(settings.gamepath)) { fs.writeFileSync(path.join( settings.gamepath, "ns_startup_args.txt" - ), settings.nsargs); + ), settings.nsargs || "-multiple"); } if (notify_renderer) { -- cgit v1.2.3