From ee885beeed57d95ffb58922cfc6b826b7ebf9a31 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Thu, 30 Dec 2021 22:05:54 +0100 Subject: first-ish draft of the mod UI and utils --- src/utils.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/utils.js') diff --git a/src/utils.js b/src/utils.js index b4ff04d..8bc6440 100644 --- a/src/utils.js +++ b/src/utils.js @@ -147,7 +147,27 @@ function winLog(msg) { ipcMain.emit("winLog", msg, msg); } +const mods = { + list: () => { + let mods = []; + let modpath = path.join(settings.gamepath, "R2Northstar/mods"); + + files = fs.readdirSync(modpath) + files.forEach((file) => { + if (fs.statSync(path.join(modpath, file)).isDirectory()) { + if (fs.existsSync(path.join(modpath, file, "mod.json"))) { + mods.push(require(path.join(modpath, file, "mod.json"))) + } + } + }) + + return mods; + }, +} + module.exports = { + mods, + lang, winLog, launch, update, -- cgit v1.2.3