From 810176c592c5cc071dd8ca14ed9519b38e1c96d9 Mon Sep 17 00:00:00 2001 From: Alystrasz Date: Tue, 28 Dec 2021 22:41:19 +0100 Subject: [feat] saving newly installed version tag --- src/utils.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils.js b/src/utils.js index e7e118d..a6be21d 100644 --- a/src/utils.js +++ b/src/utils.js @@ -48,6 +48,10 @@ function setpath(win) { cli.exit(); } +function saveSettings() { + fs.writeFileSync(app.getPath("appData") + "/viper.json", JSON.stringify({...settings})); +} + function getNorthstarInstalledVersion() { const configFilePath = app.getPath("appData") + "/viper.json"; return JSON.parse(fs.readFileSync(configFilePath, "utf8"))['northstarVersion']; @@ -64,7 +68,7 @@ function update() { console.log("Downloading..."); const version = getNorthstarInstalledVersion(); console.log(version); - + request({ json: true, headers: {"User-Agent": "Viper"}, @@ -82,6 +86,8 @@ function update() { fs.createReadStream(settings.zip).pipe(unzip.Extract({path: settings.gamepath})) .on("finish", () => { console.log("Installation/Update finished!"); + settings.northstarVersion = tag; + saveSettings(); events.emit("updated"); for (let i = 0; i < settings.excludes.length; i++) { -- cgit v1.2.3