Skip to content

Commit

Permalink
fixed settings file refusing to save if invalid
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
0neGal committed Sep 13, 2023
1 parent 0e0fc10 commit 4936917
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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) {
Expand Down

0 comments on commit 4936917

Please sign in to comment.