From 32b033d6dac63cb6cf783394d20459dd44b9459a Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 3 May 2022 00:03:05 +0200 Subject: modfile. enable(), disable() and toggle() now work --- src/utils.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/utils.js b/src/utils.js index d1b1ebb..971ecd9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -539,10 +539,20 @@ const mods = { fs.writeFileSync(file, JSON.stringify(names)) }, + disable: (mod) => { + let data = require(file); + data[mod] = false; + fs.writeFileSync(file, JSON.stringify(data)); + }, + enable: (mod) => { + let data = require(file); + data[mod] = true; + fs.writeFileSync(file, JSON.stringify(data)); + }, toggle: (mod) => { let data = require(file); - data[mod] = !data[mod]; - console.log(data) + data[mod] = ! data[mod]; + fs.writeFileSync(file, JSON.stringify(data)); }, get: () => { let enabled = []; @@ -901,8 +911,7 @@ const mods = { } }; -mods.modfile().gen(); -console.log(mods.modfile().toggle("EladNLG.HUDRevamp")) +console.log(mods.list()) setInterval(() => { if (gamepathExists()) { ipcMain.emit("guigetmods"); -- cgit v1.2.3