aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
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 /src/utils.js
parent03a9237fd1552856c6b83d0cf7fa76c7db1a1e29 (diff)
downloadViper-3df0dbf5d83740e4493a561e1bab4feb5e7fc5de.tar.gz
Viper-3df0dbf5d83740e4493a561e1bab4feb5e7fc5de.zip
fix edge case for when Archives/mods doesn't exist
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js7
1 files changed, 5 insertions, 2 deletions
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 {