diff options
author | 0neGal <mail@0negal.com> | 2022-02-09 01:44:02 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-02-09 01:44:02 +0100 |
commit | 7512d726cd31f757dc47f0c5f275ec09c1b3a765 (patch) | |
tree | 415ca3a75bd961abba1b830fbf1da67395b40398 /src | |
parent | cf53a50c9a95256ce2c7261cbd32095ff95466c1 (diff) | |
download | Viper-7512d726cd31f757dc47f0c5f275ec09c1b3a765.tar.gz Viper-7512d726cd31f757dc47f0c5f275ec09c1b3a765.zip |
fixed false alarms of failed installs
The failed to install toast now pops up when it actually should.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.js | 16 |
1 files 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); }) }) }, |