diff options
author | 0neGal <mail@0negal.com> | 2022-05-03 00:28:51 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-05-03 00:28:51 +0200 |
commit | 0290e8e2f9e2e04c1958f61fbded32a21cd98043 (patch) | |
tree | f2248860cb8190703d25d1231bf26d25c3c4d43d | |
parent | e5fa26a944f8a4d025ce9fcc2aa1ec8fbf26874b (diff) | |
download | Viper-0290e8e2f9e2e04c1958f61fbded32a21cd98043.tar.gz Viper-0290e8e2f9e2e04c1958f61fbded32a21cd98043.zip |
hopefully fully implement everything?? i think?
Everything seems to be working just fine, and I can't find any problems,
so I'll likely merge this soon.
-rw-r--r-- | src/utils.js | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/utils.js b/src/utils.js index eb833d3..4afbb2b 100644 --- a/src/utils.js +++ b/src/utils.js @@ -542,7 +542,12 @@ const mods = { }, toggle: (mod) => { let data = require(file); - data[mod] = ! data[mod]; + if (data[mod] != undefined) { + data[mod] = ! data[mod]; + } else { + data[mod] = false; + } + fs.writeFileSync(file, JSON.stringify(data)); }, get: (mod) => { @@ -796,8 +801,6 @@ const mods = { // you checked for if a mod is already disable and if not run the // function. However we currently have no need for that. toggle: (mod, fork) => { - let modpath = path.join(settings.gamepath, "R2Northstar/mods"); - if (getNSVersion() == "unknown") { winLog(lang("general.notinstalled")) console.log("error: " + lang("general.notinstalled")) @@ -816,27 +819,7 @@ const mods = { return } - let disabled = path.join(modpath, "disabled"); - if (! fs.existsSync(disabled)) { - fs.mkdirSync(disabled) - } - - let modName = mods.get(mod).FolderName; - if (! modName) { - console.log("error: " + lang("cli.mods.cantfind")) - cli.exit(1); - return; - } - - let modPath = path.join(modpath, modName); - let dest = path.join(disabled, modName); - - if (mods.get(mod).Disabled) { - modPath = path.join(disabled, modName); - dest = path.join(modpath, modName); - } - - fs.moveSync(modPath, dest) + mods.modfile().toggle(mod); if (! fork) { console.log(lang("cli.mods.toggled")); cli.exit(); @@ -845,7 +828,6 @@ const mods = { } }; -console.log(mods.list()) setInterval(() => { if (gamepathExists()) { ipcMain.emit("guigetmods"); |