From 04ce533ced37d3a7a938ebbcb02062b27aca1789 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sun, 4 Feb 2024 17:25:18 +0100 Subject: 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. --- src/modules/mods.js | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file 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; } -- cgit v1.2.3