From 3df0dbf5d83740e4493a561e1bab4feb5e7fc5de Mon Sep 17 00:00:00 2001 From: GitExample Date: Sat, 5 Feb 2022 17:46:57 +0100 Subject: fix edge case for when Archives/mods doesn't exist --- src/app/browser.js | 2 -- src/utils.js | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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 { -- cgit v1.2.3