From 7512d726cd31f757dc47f0c5f275ec09c1b3a765 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Wed, 9 Feb 2022 01:44:02 +0100 Subject: fixed false alarms of failed installs The failed to install toast now pops up when it actually should. --- src/utils.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/utils.js b/src/utils.js index 49e87eb..009b5cd 100644 --- a/src/utils.js +++ b/src/utils.js @@ -516,15 +516,16 @@ const mods = { if (fs.existsSync(path.join(mod, files[i], "mod.json")) && fs.statSync(path.join(mod, files[i], "mod.json")).isFile()) { - console.log(mods.install(path.join(mod, files[i]))) + mods.install(path.join(mod, files[i])) if (mods.install(path.join(mod, files[i]))) {return true}; } } } - notamod(); - return false; + return notamod(); } + + return notamod(); } else { winLog(lang("gui.mods.extracting")) let cache = path.join(app.getPath("userData"), "Archives"); @@ -542,7 +543,6 @@ const mods = { let manifest = path.join(cache, "manifest.json"); if (fs.existsSync(manifest)) { files = fs.readdirSync(path.join(cache, "mods")); - if (fs.existsSync(path.join(cache, "mods/mod.json"))) { if (mods.install(path.join(cache, "mods"), require(manifest).name, manifest, true)) { return true; @@ -556,9 +556,13 @@ const mods = { }, 1000) } } + + if (files.length == 0) { + ipcMain.emit("failedmod"); + return notamod(); + } } - ipcMain.emit("failedmod", "", modname); return notamod(); } @@ -604,7 +608,7 @@ const mods = { stream.on("finish", () => { stream.close(); - mods.install(modlocation) + mods.install(modlocation); }) }) }, -- cgit v1.2.3