diff options
author | Rémy Raes <contact@remyraes.com> | 2022-01-07 23:19:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 23:19:32 +0100 |
commit | 47c9ea288b97e1c11baaadde7cc24d6704d8ea22 (patch) | |
tree | f7c212d2c0b85a923c9f616958561bae94378219 /src/utils.js | |
parent | 81024fb393af7a2ec6b96c7ae40f415b01718a40 (diff) | |
download | Viper-47c9ea288b97e1c11baaadde7cc24d6704d8ea22.tar.gz Viper-47c9ea288b97e1c11baaadde7cc24d6704d8ea22.zip |
fix: Game path check (#29)
* [feat] adding methods signature to alert when selected game path is falsy
* [feat] a game path is valid if it contains 'Titanfall2.exe' file
* [feat] adding translations for wrong gamepath key
* [feat] if a wrong path has been selected, ask for it again
* formatting and removing useless function
Given we only use checkGamePath() once there's no need to even have a
function for it.
Co-authored-by: 0neGal <mail@0negal.com>
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils.js b/src/utils.js index 85db119..872320e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -42,6 +42,11 @@ function setpath(win) { ipcMain.emit("newpath", null, false); return; } + if (! fs.existsSync(path.join(res.filePaths[0], "Titanfall2.exe"))) { + ipcMain.emit("wrongpath"); + return; + } + settings.gamepath = res.filePaths[0]; settings.zip = path.join(settings.gamepath + "/northstar.zip"); saveSettings(); |