From 97ce13906b7f2c511808de14e80f16b29e0f432a Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Mon, 5 Aug 2024 20:38:03 +0200 Subject: [PATCH] chore: prevent gamepath permission alert from reopening on same gamepath Co-authored-by: 0neGal --- src/modules/gamepath.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/gamepath.js b/src/modules/gamepath.js index 1e1153e..57b9ffa 100644 --- a/src/modules/gamepath.js +++ b/src/modules/gamepath.js @@ -55,8 +55,9 @@ ipcMain.on("missing-perms", async (e, selected_gamepath) => { }) ipcMain.on("gamepath-lost-perms", async (e, selected_gamepath) => { - if (! gamepath.setting) { - gamepath.setting = true; + if (! gamepath.setting && gamepath.lost_perms != selected_gamepath) { + console.log(gamepath.lost_perms); + gamepath.lost_perms = selected_gamepath; await win().alert(lang("gui.gamepath.lost_perms") + selected_gamepath); ipcMain.emit("setpath"); } @@ -167,6 +168,8 @@ gamepath.set = async (win, force_dialog) => { return gamepath.setting = false; } + delete gamepath.lost_perms; + if (! fs.existsSync(path.join(res.filePaths[0], "Titanfall2.exe"))) { ipcMain.emit("wrong-path"); return gamepath.setting = false;