aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2022-01-04 17:41:13 +0100
committerGitHub <noreply@github.com>2022-01-04 17:41:13 +0100
commit145baa0e1606816d7784deac8eafa58490854141 (patch)
tree923f903fe82575c5ce571453b132be0a2b9ee459 /src/utils.js
parent0c30429ab4b0a941f00b7ced79065ef05575d583 (diff)
downloadViper-145baa0e1606816d7784deac8eafa58490854141.tar.gz
Viper-145baa0e1606816d7784deac8eafa58490854141.zip
fix: No game path (#24)
* [refactor] moving main.setPath listener outside start method * [refactor] setpath tells if game path is set or not * newpath event tells if game path dialog is successful or not * [feat] main window will not show if path is not set * [feat] viper displays a dialog and exits if no game path was prompted * [fix] viper prompts for game path if viper.json:gamepath is not set * [feat] translating gui.gamepath.must key * code cleanup fixing single quotes and alike * fix gui.gamepath.must message Co-authored-by: 0neGal <mail@0negal.com>
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils.js b/src/utils.js
index 35c8932..d2e6fe6 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -38,10 +38,15 @@ function setpath(win) {
settings.gamepath = cli.param("setpath");
} else {
dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => {
+ if (res.canceled) {
+ ipcMain.emit("newpath", null, false);
+ return;
+ }
settings.gamepath = res.filePaths[0];
settings.zip = path.join(settings.gamepath + "/northstar.zip");
saveSettings();
win.webContents.send("newpath", settings.gamepath);
+ ipcMain.emit("newpath", null, settings.gamepath);
}).catch(err => {console.error(err)})
}