aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-09-13 18:22:38 +0200
committer0neGal <mail@0negal.com>2023-09-13 18:22:38 +0200
commit4936917f1ee64c89d5443d824d828e8f537154a5 (patch)
tree41353b89ef034af77041e9f69e63882b65be2980
parent0e0fc10e5a36bb9fef7bfba7bb1bb088eca5a60d (diff)
downloadViper-4936917f1ee64c89d5443d824d828e8f537154a5.tar.gz
Viper-4936917f1ee64c89d5443d824d828e8f537154a5.zip
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.
-rw-r--r--src/modules/settings.js4
1 files 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) {