diff options
author | 0neGal <mail@0negal.com> | 2022-01-24 18:21:13 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-01-24 18:21:13 +0100 |
commit | 9c6ac295189acab7303952725755dfac87e18470 (patch) | |
tree | 2832c0f0463c81dbe80a2c939178b7d8f165eb89 /src/utils.js | |
parent | 0c0cce0d79cc222cd467b6499d06ccb7d222cd0b (diff) | |
download | Viper-9c6ac295189acab7303952725755dfac87e18470.tar.gz Viper-9c6ac295189acab7303952725755dfac87e18470.zip |
no alert when manually changing the game path
When changing the game path by clicking the button you shouldn't be told
it can't find the game and you've to select one manually, as you know
that already. More importantly, if it could be found automatically it'll
just not do anything.
With this change I also changed the "gui.setpath" string to be more
logical, and to make it clear what it does.
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/utils.js b/src/utils.js index ef647fe..fb94b92 100644 --- a/src/utils.js +++ b/src/utils.js @@ -116,7 +116,7 @@ northstar_auto_updates: { // // If running with CLI it takes in the --setpath argument otherwise it // open the systems file browser for the user to select a path. -async function setpath(win) { +async function setpath(win, forcedialog) { function setGamepath(folder) { settings.gamepath = folder; settings.zip = path.join(settings.gamepath + "/northstar.zip"); @@ -128,21 +128,23 @@ async function setpath(win) { if (! win) { // CLI setGamepath(cli.param("setpath")); } else { // GUI - function setGamepath(folder) { - settings.gamepath = folder; - settings.zip = path.join(settings.gamepath + "/northstar.zip"); - saveSettings(); - win.webContents.send("newpath", settings.gamepath); - ipcMain.emit("newpath", null, settings.gamepath); - } + if (! forcedialog) { + function setGamepath(folder, forcedialog) { + settings.gamepath = folder; + settings.zip = path.join(settings.gamepath + "/northstar.zip"); + saveSettings(); + win.webContents.send("newpath", settings.gamepath); + ipcMain.emit("newpath", null, settings.gamepath); + } - let gamepath = await findgame(); - if (gamepath) { - setGamepath(gamepath); - return; - } + let gamepath = await findgame(); + if (gamepath) { + setGamepath(gamepath); + return; + } - alert(lang("general.missingpath")); + winAlert(lang("general.missingpath")); + } // Fallback to manual selection dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => { |