aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-05-16 00:19:50 +0200
committer0neGal <mail@0negal.com>2022-05-16 00:19:50 +0200
commit52de086f36e5b32643fa641e072c56d53a6d2bc1 (patch)
tree299e332c6d21bdaa561d652f49b4f38ff0cae297
parent72f85aa2297f5c46d029f1e25193aa98ced884c3 (diff)
downloadViper-52de086f36e5b32643fa641e072c56d53a6d2bc1.tar.gz
Viper-52de086f36e5b32643fa641e072c56d53a6d2bc1.zip
already installed dependencies are now skipped
If you already have all the dependencies or some dependencies of a package those will be skipped, if there is no dependencies missing it'll just install, and otherwise it'll show the missing and ask whether you want to install them. Meaning if a package has two dependencies and you've one of them only the one you don't have will show up.
-rw-r--r--src/app/main.js24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 109ca61..362450a 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -217,9 +217,12 @@ function installFromURL(url, dependencies, clearqueue) {
let depend = dependencies[i].toLowerCase();
console.log(depend)
if (! depend.match(/northstar-northstar-.*/)) {
- newdepends.push(dependencies[i].replaceAll("-", "/"));
- let pkg = newdepends[newdepends.length - 1].split("/");
- prettydepends.push(`${pkg[1]} v${pkg[2]} - ${lang("gui.browser.madeby")} ${pkg[0]}`);
+ depend = dependencies[i].replaceAll("-", "/");
+ let pkg = depend.split("/");
+ if (! isModInstalled(pkg[1])) {
+ newdepends.push(depend);
+ prettydepends.push(`${pkg[1]} v${pkg[2]} - ${lang("gui.browser.madeby")} ${pkg[0]}`);
+ }
}
}
@@ -241,6 +244,21 @@ function installFromURL(url, dependencies, clearqueue) {
}
}
+function isModInstalled(modname) {
+ for (let i = 0; i < modsobj.all.length; i++) {
+ let mod = modsobj.all[i];
+ if (mod.ManifestName) {
+ if (mod.ManifestName.match(modname)) {
+ return true;
+ }
+ } else if (mod.Name.match(modname)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
// Frontend part of settings a new game path
ipcRenderer.on("newpath", (event, newpath) => {
settings.gamepath = newpath;