From ee7dab5b056e254bff828a9b9f6d77be2287b935 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Thu, 17 Feb 2022 23:07:18 +0100 Subject: fixed buttons not re-enabling when closing install If you closed the file selection window after clicking the "Install Mod" button it would improperly try to install "nothing", and therefore never re-enable the buttons, this is now fixed. --- src/app/main.js | 2 ++ src/index.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/main.js b/src/app/main.js index 169f86f..7c71c9d 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -78,6 +78,8 @@ function setButtons(state) { disablearray(document.querySelectorAll("#browser #browserEntries .text button")) } +ipcRenderer.on("setbuttons", (event, state) => {setButtons(state)}) + // Frontend part of updating Northstar ipcRenderer.on("ns-update-event", (event, key) => { document.getElementById("update").innerText = `(${lang(key)})`; diff --git a/src/index.js b/src/index.js index a06cf69..344ac6c 100644 --- a/src/index.js +++ b/src/index.js @@ -76,7 +76,11 @@ ipcMain.on("installmod", () => { utils.mods.install(cli.param("installmod")) } else { dialog.showOpenDialog({properties: ["openFile"]}).then(res => { - utils.mods.install(res.filePaths[0]); + if (res.filePaths.length != 0) { + utils.mods.install(res.filePaths[0]); + } else { + win.webContents.send("setbuttons", true); + } }).catch(err => {console.error(err)}) } }) -- cgit v1.2.3