diff options
author | 0neGal <mail@0negal.com> | 2022-01-08 15:25:56 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-01-08 15:25:56 +0100 |
commit | 66e1499c3db2af9ec2002ae18b62892bbece992d (patch) | |
tree | 2e270dd5719bbdb6701f073c48e6e2415b3f498c | |
parent | 1c12fb2e90d26e25be6206076ad6762fa92a5962 (diff) | |
download | Viper-66e1499c3db2af9ec2002ae18b62892bbece992d.tar.gz Viper-66e1499c3db2af9ec2002ae18b62892bbece992d.zip |
fixed error if you ran --installmod without args
-rw-r--r-- | src/utils.js | 11 |
1 files 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) => { |