diff options
author | 0neGal <mail@0negal.com> | 2022-05-03 00:35:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 00:35:15 +0200 |
commit | db4b58db838753c0ecc00eb00967e7c39356ba8f (patch) | |
tree | 1b20751bd051accdfad5e980c9abaff3ebd47225 | |
parent | 0290e8e2f9e2e04c1958f61fbded32a21cd98043 (diff) | |
parent | a870336695da962623c87e30f4a0cbd29684b8c2 (diff) | |
download | Viper-db4b58db838753c0ecc00eb00967e7c39356ba8f.tar.gz Viper-db4b58db838753c0ecc00eb00967e7c39356ba8f.zip |
Merge branch 'main' into enabledmods
-rw-r--r-- | src/cli.js | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -36,7 +36,7 @@ function exit(code) { // Ensures the gamepath exists, it's called by options that require the // gamepath to be able to work. -function gamepath() { +function gamepathExists() { if (fs.existsSync("viper.json")) { gamepath = JSON.parse(fs.readFileSync("viper.json", "utf8")).gamepath; @@ -77,9 +77,9 @@ async function init() { } // --update - if (gamepath() && cli.hasSwitch("update")) {ipcMain.emit("update")} + if (cli.hasSwitch("update") && gamepathExists()) {ipcMain.emit("update")} // --version - if (gamepath() && cli.hasSwitch("version")) {ipcMain.emit("versioncli")} + if (cli.hasSwitch("version") && gamepathExists()) {ipcMain.emit("versioncli")} // --setpath if (cli.hasSwitch("setpath")) { @@ -93,7 +93,7 @@ async function init() { } // --launch - if (gamepath() && cli.hasSwitch("launch")) { + if (gamepathExists() && cli.hasSwitch("launch")) { switch(cli.getSwitchValue("launch")) { case "vanilla": ipcMain.emit("launchVanilla"); @@ -105,12 +105,12 @@ async function init() { } // Mod related args, --installmod, --removemod, --togglemod - if (gamepath() && cli.hasSwitch("installmod")) {ipcMain.emit("installmod")} - if (gamepath() && cli.hasSwitch("removemod")) {ipcMain.emit("removemod", "", cli.getSwitchValue("removemod"))} - if (gamepath() && cli.hasSwitch("togglemod")) {ipcMain.emit("togglemod", "", cli.getSwitchValue("togglemod"))} + if (cli.hasSwitch("installmod") && gamepathExists()) {ipcMain.emit("installmod")} + if (cli.hasSwitch("removemod") && gamepathExists()) {ipcMain.emit("removemod", "", cli.getSwitchValue("removemod"))} + if (cli.hasSwitch("togglemod") && gamepathExists()) {ipcMain.emit("togglemod", "", cli.getSwitchValue("togglemod"))} // Prints out the list of mods - if (gamepath() && cli.hasSwitch("mods")) {ipcMain.emit("getmods")} + if (cli.hasSwitch("mods") && gamepathExists()) {ipcMain.emit("getmods")} } module.exports = { |