diff options
author | 0neGal <mail@0negal.com> | 2022-02-08 23:22:39 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-02-08 23:22:39 +0100 |
commit | 0a317f81def6b4c041cfc340e454a9bc8f0046fb (patch) | |
tree | f8be9e32dbef3ed9fc1a8a961420d9402dea2bbe /src/utils.js | |
parent | 0813769008f5436e1cea2ad97f1a527c8ce94df7 (diff) | |
download | Viper-0a317f81def6b4c041cfc340e454a9bc8f0046fb.tar.gz Viper-0a317f81def6b4c041cfc340e454a9bc8f0046fb.zip |
added toasts for installation of mods
It'll notify of incorrectly formatted mods, it'll also notify on errors
and on success.
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/utils.js b/src/utils.js index b825309..7a1e333 100644 --- a/src/utils.js +++ b/src/utils.js @@ -450,7 +450,7 @@ const mods = { // Either a zip or folder is supported, we'll also try to search // inside the zip or folder to see if buried in another folder or // not, as sometimes that's the case. - install: (mod, destname, manifestfile) => { + install: (mod, destname, manifestfile, malformed = false) => { let modname = mod.replace(/^.*(\\|\/|\:)/, ""); if (getNSVersion() == "unknown") { @@ -481,7 +481,10 @@ const mods = { } } - ipcMain.emit("installedmod", "", modname); + ipcMain.emit("installedmod", "", { + name: modname, + malformed: malformed, + }); ipcMain.emit("guigetmods"); return true; } @@ -539,7 +542,7 @@ const mods = { 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)) { + if (mods.install(path.join(cache, "mods"), require(manifest).name, manifest, true)) { return true; } } else { @@ -553,6 +556,7 @@ const mods = { } } + ipcMain.emit("failedmod", "", modname); return notamod(); } |