From e9bd16e8cee14b983bad23cbae088794bb80349d Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Tue, 28 Dec 2021 22:37:18 +0100 Subject: [feat] storing local northstar version in viper.json --- src/utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/utils.js b/src/utils.js index 376c03c..e7e118d 100644 --- a/src/utils.js +++ b/src/utils.js @@ -17,6 +17,7 @@ process.chdir(app.getPath("appData")); var settings = { gamepath: "", zip: "/northstar.zip", + northstarVersion: "unknown", excludes: [ "ns_startup_args.txt", "ns_startup_args_dedi.txt" @@ -47,6 +48,11 @@ function setpath(win) { cli.exit(); } +function getNorthstarInstalledVersion() { + const configFilePath = app.getPath("appData") + "/viper.json"; + return JSON.parse(fs.readFileSync(configFilePath, "utf8"))['northstarVersion']; +} + function update() { for (let i = 0; i < settings.excludes.length; i++) { let exclude = path.join(settings.gamepath + "/" + settings.excludes[i]); @@ -56,6 +62,9 @@ function update() { } console.log("Downloading..."); + const version = getNorthstarInstalledVersion(); + console.log(version); + request({ json: true, headers: {"User-Agent": "Viper"}, -- cgit v1.2.3