From 47c9ea288b97e1c11baaadde7cc24d6704d8ea22 Mon Sep 17 00:00:00 2001 From: Rémy Raes Date: Fri, 7 Jan 2022 23:19:32 +0100 Subject: 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 --- src/utils.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/utils.js') 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(); -- cgit v1.2.3