aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
diff options
context:
space:
mode:
authorAlystrasz <contact@remyraes.com>2021-12-28 22:41:19 +0100
committerAlystrasz <contact@remyraes.com>2021-12-28 22:41:19 +0100
commit810176c592c5cc071dd8ca14ed9519b38e1c96d9 (patch)
tree78ed4678fb3897bb8e9964edd37207bbb1639a77 /src/utils.js
parente9bd16e8cee14b983bad23cbae088794bb80349d (diff)
downloadViper-810176c592c5cc071dd8ca14ed9519b38e1c96d9.tar.gz
Viper-810176c592c5cc071dd8ca14ed9519b38e1c96d9.zip
[feat] saving newly installed version tag
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js8
1 files changed, 7 insertions, 1 deletions
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++) {