diff options
author | 0neGal <mail@0negal.com> | 2024-02-04 17:25:18 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2024-02-04 17:28:18 +0100 |
commit | 04ce533ced37d3a7a938ebbcb02062b27aca1789 (patch) | |
tree | 7a135b898186a3a64b8c1248eeadc0216fe89207 /src/modules | |
parent | ee816e6a1aa908df381dcc488b1193d1e78e0ca6 (diff) | |
download | Viper-04ce533ced37d3a7a938ebbcb02062b27aca1789.tar.gz Viper-04ce533ced37d3a7a938ebbcb02062b27aca1789.zip |
fixed "Northstar is not installed!" when updating
After Northstar has been downloaded, we start extracting into the
gamepath, this causes Viper to think Northstar isn't installed, which is
fine, except it'd whine about it when many `src/modules/mods.js`
functions we're called, some of which get run on an interval, so it'd
often lead you to have multiple "Northstar is not installed!" messages
whilst updating Northstar. Which is quite unneccesary and it may also,
be able to confuse the user, as to whether something has gone wrong.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/mods.js | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/src/modules/mods.js b/src/modules/mods.js index 77436a2..97d4e16 100644 --- a/src/modules/mods.js +++ b/src/modules/mods.js @@ -6,6 +6,7 @@ const { https } = require("follow-redirects"); const { app, ipcMain, dialog } = require("electron"); const json = require("./json"); +const update = require("./update"); const version = require("./version"); const settings = require("./settings"); @@ -93,8 +94,13 @@ mods.list = () => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { - win().log(lang("general.not_installed")); - console.error(lang("general.not_installed")); + // notify user of missing Northstar, unless its because its + // currently being updated + if (! update.northstar.updating) { + win().log(lang("general.not_installed")); + console.error(lang("general.not_installed")); + } + cli.exit(1); return false; } @@ -239,8 +245,13 @@ mods.get = (mod) => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { - win().log(lang("general.not_installed")); - console.error(lang("general.not_installed")); + // notify user of missing Northstar, unless its because its + // currently being updated + if (! update.northstar.updating) { + win().log(lang("general.not_installed")); + console.error(lang("general.not_installed")); + } + cli.exit(1); return false; } @@ -373,8 +384,13 @@ mods.install = (mod, opts) => { } if (version.northstar() == "unknown") { - win().log(lang("general.not_installed")); - console.error(lang("general.not_installed")); + // notify user of missing Northstar, unless its because its + // currently being updated + if (! update.northstar.updating) { + win().log(lang("general.not_installed")); + console.error(lang("general.not_installed")); + } + cli.exit(1); return false; } @@ -620,8 +636,13 @@ mods.remove = (mod) => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { - win().log(lang("general.not_installed")); - console.error(lang("general.not_installed")); + // notify user of missing Northstar, unless its because its + // currently being updated + if (! update.northstar.updating) { + win().log(lang("general.not_installed")); + console.error(lang("general.not_installed")); + } + cli.exit(1); return false; } @@ -692,8 +713,13 @@ mods.toggle = (mod, fork) => { // make sure Northstar is actually installed if (version.northstar() == "unknown") { - win().log(lang("general.not_installed")); - console.error(lang("general.not_installed")); + // notify user of missing Northstar, unless its because its + // currently being updated + if (! update.northstar.updating) { + win().log(lang("general.not_installed")); + console.error(lang("general.not_installed")); + } + cli.exit(1); return false; } |