From 0cae81f6e2c9ea6e5501395fd00af7085e3b4e74 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Thu, 10 Mar 2022 20:18:24 +0100 Subject: fix nsargs being cleared when edited out of Viper (#93) If the nsargs are edited by a third-party program or anything that isn't Viper, the next time you launch Viper it'll reset the nsargs back to what it was when you last opened it. --- src/app/main.js | 5 +++++ src/utils.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/app/main.js b/src/app/main.js index a781ef1..1688ab2 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -33,6 +33,11 @@ if (fs.existsSync("viper.json")) { } else { setpath(true); } + + let args = path.join(settings.gamepath, "ns_startup_args.txt"); + if (fs.existsSync(args)) { + settings.nsargs = fs.readFileSync(args, "utf8"); + } } else { setpath(); } diff --git a/src/utils.js b/src/utils.js index 6069a46..7c1c22b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -39,6 +39,11 @@ var settings = { if (fs.existsSync("viper.json")) { settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))}; settings.zip = path.join(settings.gamepath + "/northstar.zip"); + + let args = path.join(settings.gamepath, "ns_startup_args.txt"); + if (fs.existsSync(args)) { + settings.nsargs = fs.readFileSync(args, "utf8"); + } } else { console.log(lang("general.missingpath")); } -- cgit v1.2.3