From 55040f6808f4aef3cd7ba86a45290d03963c37bd Mon Sep 17 00:00:00 2001 From: 0neGal Date: Mon, 24 Jul 2023 20:05:10 +0200 Subject: make sure profile exists, then create packages 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. --- src/modules/packages.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/modules') 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) => { -- cgit v1.2.3