aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2021-12-31 15:34:56 +0100
committer0neGal <mail@0negal.com>2021-12-31 15:34:56 +0100
commit3c948969bbd203d3e4ab4bd05ce25b4c6277094d (patch)
tree99878dddd355f262f005e17759bbf048a08d2ed3 /src/utils.js
parentc8fec42e085ef255a01f62c5010e2d41bb7eb05f (diff)
parentaddc349189f582a1d8a833ba554f7b8df9205dd4 (diff)
downloadViper-3c948969bbd203d3e4ab4bd05ce25b4c6277094d.tar.gz
Viper-3c948969bbd203d3e4ab4bd05ce25b4c6277094d.zip
Merge branch 'feat/version-indicator' of https://github.com/Alystrasz/viper into Alystrasz-feat/version-indicator
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/utils.js b/src/utils.js
index b4ff04d..06acbdf 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -52,8 +52,8 @@ function saveSettings() {
fs.writeFileSync(app.getPath("appData") + "/viper.json", JSON.stringify(settings));
}
-function getInstalledVersion() {
- const versionFilePath = path.join(settings.gamepath, "ns_version.txt");
+function getNSVersion() {
+ var versionFilePath = path.join(settings.gamepath, "ns_version.txt");
if (fs.existsSync(versionFilePath)) {
return fs.readFileSync(versionFilePath, "utf8");
@@ -73,7 +73,7 @@ function update() {
ipcMain.emit("ns-updating");
console.log(lang("cli.update.checking"));
- const version = getInstalledVersion();
+ var version = getNSVersion();
request({
json: true,
@@ -106,6 +106,7 @@ function update() {
fs.createReadStream(settings.zip).pipe(unzip.Extract({path: settings.gamepath}))
.on("finish", () => {
fs.writeFileSync(path.join(settings.gamepath, "ns_version.txt"), tag);
+ ipcMain.emit("getversion");
for (let i = 0; i < settings.excludes.length; i++) {
let exclude = path.join(settings.gamepath + "/" + settings.excludes[i]);
@@ -153,6 +154,7 @@ module.exports = {
update,
setpath,
settings,
+ getNSVersion,
setlang: (lang) => {
settings.lang = lang;
saveSettings();