aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-07-24 20:05:10 +0200
committer0neGal <mail@0negal.com>2023-07-24 20:05:10 +0200
commit55040f6808f4aef3cd7ba86a45290d03963c37bd (patch)
treeafeac6f0d804be5d4f812afcbadc63ff8d2854fa /src/modules
parent54d6254c1a502aa77f21ac78f55d1e5d127bb20c (diff)
downloadViper-55040f6808f4aef3cd7ba86a45290d03963c37bd.tar.gz
Viper-55040f6808f4aef3cd7ba86a45290d03963c37bd.zip
make sure profile exists, then create packages dirpackages-dir
If the gamepath isn't found or unmounted or similar, then the profile doesn't exist either, but we previously just assumed that it did, now we refuse to create the `packages` folder, fixing an error.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/packages.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/packages.js b/src/modules/packages.js
index 8a5af76..c9fb1c4 100644
--- a/src/modules/packages.js
+++ b/src/modules/packages.js
@@ -23,8 +23,12 @@ function update_path() {
} else {return}
}
- // create the folder, in case it doesn't already exist
- fs.mkdirSync(packages.path);
+ // only create folder if the profile folder exists
+ if (fs.existsSync(path.dirname(packages.path))) {
+ // create the folder, in case it doesn't already exist
+ fs.mkdirSync(packages.path);
+ }
+
}; update_path();
packages.format_name = (author, package_name, version) => {