diff options
-rw-r--r-- | src/app/main.js | 5 | ||||
-rw-r--r-- | src/index.js | 2 | ||||
-rw-r--r-- | src/lang/en.json | 1 | ||||
-rw-r--r-- | src/lang/fr.json | 1 | ||||
-rw-r--r-- | src/utils.js | 5 |
5 files changed, 14 insertions, 0 deletions
diff --git a/src/app/main.js b/src/app/main.js index aa2ba68..00d3551 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -84,6 +84,11 @@ ipcRenderer.on("nopathselected", () => { exit(); }); +ipcRenderer.on("wrongpath", () => { + alert(lang("gui.gamepath.wrong")); + setpath(false); +}); + setlang(); setInterval(() => { ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 20); diff --git a/src/index.js b/src/index.js index 330b2b7..53781dd 100644 --- a/src/index.js +++ b/src/index.js @@ -72,6 +72,8 @@ ipcMain.on("newpath", (event, newpath) => { win.show(); } } +}); ipcMain.on("wrongpath", (event) => { + win.webContents.send("wrongpath"); }); ipcMain.on("getversion", () => { diff --git a/src/lang/en.json b/src/lang/en.json index cc75268..10f03cd 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -37,6 +37,7 @@ "gui.selectpath": "Please select the path!", "gui.gamepath.must": "The game path must be set to start Viper.", + "gui.gamepath.wrong": "This folder is not a valid game path.", "general.launching": "Launching", diff --git a/src/lang/fr.json b/src/lang/fr.json index 870fbfe..0cd9bfb 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -37,6 +37,7 @@ "gui.selectpath": "Veuillez sélectionner le dossier où se trouve le client Titanfall 2.", "gui.gamepath.must": "Vous devez sélectionner le chemin du dossier du jeu Titanfall 2 pour pouvoir lancer Viper.", + "gui.gamepath.wrong": "Ce dossier ne contient pas le jeu Titanfall 2, et n'est donc pas valide.", "general.launching": "Lancement", 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(); |