diff options
author | 0neGal <mail@0negal.com> | 2021-12-30 22:05:54 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2021-12-30 22:05:54 +0100 |
commit | ee885beeed57d95ffb58922cfc6b826b7ebf9a31 (patch) | |
tree | 6cc217060683a950561b3e5da828d52f7b60c63a /src/utils.js | |
parent | 823d34f6f41c65c7b1cb8e55bd429b9efc4f3878 (diff) | |
download | Viper-ee885beeed57d95ffb58922cfc6b826b7ebf9a31.tar.gz Viper-ee885beeed57d95ffb58922cfc6b826b7ebf9a31.zip |
first-ish draft of the mod UI and utils
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 20 |
1 files changed, 20 insertions, 0 deletions
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, |