From 4530f682a674ac53f813f2c4194430cbe299f86d Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 15 Jan 2022 03:02:20 +0100 Subject: fix error when R2Northstar/mods isn't created --- src/utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils.js b/src/utils.js index 17091b4..4cdb5f5 100644 --- a/src/utils.js +++ b/src/utils.js @@ -271,6 +271,15 @@ const mods = { let mods = []; let disabled = []; + if (! fs.existsSync(modpath)) { + fs.mkdirSync(path.join(modpath + "disabled"), {recursive: true}) + return { + enabled: [], + disabled: [], + all: [] + }; + } + files = fs.readdirSync(modpath) files.forEach((file) => { if (fs.statSync(path.join(modpath, file)).isDirectory()) { -- cgit v1.2.3