From 66e1499c3db2af9ec2002ae18b62892bbece992d Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 8 Jan 2022 15:25:56 +0100 Subject: fixed error if you ran --installmod without args --- src/utils.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils.js b/src/utils.js index 1e05fed..67aee02 100644 --- a/src/utils.js +++ b/src/utils.js @@ -242,6 +242,7 @@ const mods = { winLog(lang("gui.mods.notamod")) console.log("error: " + lang("cli.mods.notamod")) cli.exit(1); + return false; } let installed = () => { @@ -250,8 +251,11 @@ const mods = { winLog(lang("gui.mods.installedmod")) ipcMain.emit("guigetmods"); + return true; } + if (! fs.existsSync(mod)) {return notamod()} + if (fs.statSync(mod).isDirectory()) { winLog(lang("gui.mods.installing")) if (fs.existsSync(path.join(mod, "mod.json")) && @@ -263,8 +267,7 @@ const mods = { utimes: true, }); - installed(); - return true; + return installed(); } else { files = fs.readdirSync(mod); @@ -296,9 +299,9 @@ const mods = { .on("finish", () => { if (mods.install(cache)) { installed(); - } else {notamod();return false} + } else {return notamod()} }); - }catch(err) {notamod();return false} + }catch(err) {return notamod()} } }, remove: (mod) => { -- cgit v1.2.3