aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitExample <git@example.com>2022-02-05 17:46:57 +0100
committerGitExample <git@example.com>2022-02-05 17:46:57 +0100
commit3df0dbf5d83740e4493a561e1bab4feb5e7fc5de (patch)
tree404886ef2fe6084f5a982654c368114b826b388c
parent03a9237fd1552856c6b83d0cf7fa76c7db1a1e29 (diff)
downloadViper-3df0dbf5d83740e4493a561e1bab4feb5e7fc5de.tar.gz
Viper-3df0dbf5d83740e4493a561e1bab4feb5e7fc5de.zip
fix edge case for when Archives/mods doesn't exist
-rw-r--r--src/app/browser.js2
-rw-r--r--src/utils.js7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index ff9ec87..3631550 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -58,7 +58,6 @@ var Browser = {
},
setbutton: (mod, string) => {
mod = normalize(mod);
- console.log(mod)
if (document.getElementById(mod)) {
let elems = document.querySelectorAll(`#${mod}`);
@@ -136,7 +135,6 @@ function BrowserEl(properties) {
ipcRenderer.on("removedmod", (event, modname) => {
setButtons(true);
- console.log("test" + modname)
Browser.setbutton(modname, lang("gui.browser.install"));
})
diff --git a/src/utils.js b/src/utils.js
index 6c24aff..048e0e6 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -448,6 +448,9 @@ const mods = {
if (fs.existsSync(path.join(mod, "mod.json")) &&
fs.statSync(path.join(mod, "mod.json")).isFile()) {
+ if (fs.existsSync(path.join(modpath, modname))) {
+ fs.rmSync(path.join(modpath, modname), {recursive: true});
+ }
copy(mod, path.join(modpath, modname))
return installed();
@@ -473,9 +476,9 @@ const mods = {
let cache = path.join(app.getPath("userData"), "Archives");
if (fs.existsSync(cache)) {
fs.rmSync(cache, {recursive: true});
- fs.mkdirSync(cache);
+ fs.mkdirSync(path.join(cache, "mods"), {recursive: true});
} else {
- fs.mkdirSync(cache);
+ fs.mkdirSync(path.join(cache, "mods"), {recursive: true});
}
try {