diff options
author | 0neGal <mail@0negal.com> | 2023-03-05 00:52:49 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2023-03-05 00:52:49 +0100 |
commit | a5dd677c6e5e6c2cb3eec7a2edc08d15dfe43c7a (patch) | |
tree | e058daee9677f5820d3130f08a34cb9ccfd8442e /src/modules | |
parent | 5d86a3daa5f762326055469b6bcd8346e0655056 (diff) | |
download | Viper-a5dd677c6e5e6c2cb3eec7a2edc08d15dfe43c7a.tar.gz Viper-a5dd677c6e5e6c2cb3eec7a2edc08d15dfe43c7a.zip |
show alert when updating with game running
This also fixes is_running not quite working on Linux
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/is_running.js | 20 | ||||
-rw-r--r-- | src/modules/update.js | 4 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/modules/is_running.js b/src/modules/is_running.js index cc91ded..5e0b67e 100644 --- a/src/modules/is_running.js +++ b/src/modules/is_running.js @@ -20,7 +20,7 @@ async function check_processes(processes) { // thing. And it's not much more clunky. let cmd = (() => { switch (process.platform) { - case "linux": return "ps -A"; + case "linux": return "ps a"; case "win32": return "tasklist"; } })(); @@ -28,37 +28,39 @@ async function check_processes(processes) { exec(cmd, (err, stdout) => { for (let i = 0; i < processes.length; i++) { if (stdout.includes(processes[i])) { + console.log("running") resolve(true); break } + console.log("not running") if (i == processes.length - 1) {resolve(false)} } }); }); } -is_running.game = async () => { - return await check_processes([ +is_running.game = () => { + return check_processes([ "NorthstarLauncher.exe", "Titanfall2.exe", "Titanfall2-unpacked.exe" ]) } -is_running.origin = async () => { - return await check_processes([ +is_running.origin = () => { + return check_processes([ "Origin.exe", ]) } -is_running.titanfall = async () => { - return await check_processes([ +is_running.titanfall = () => { + return check_processes([ "Titanfall2.exe", "Titanfall2-unpacked.exe" ]) } -is_running.northstar = async () => { - return await check_processes([ +is_running.northstar = () => { + return check_processes([ "NorthstarLauncher.exe", ]) } diff --git a/src/modules/update.js b/src/modules/update.js index cfdb42b..2c75cac 100644 --- a/src/modules/update.js +++ b/src/modules/update.js @@ -63,7 +63,7 @@ update.northstar_autoupdate = () => { if (await northstar_update_available()) { console.log(lang("cli.autoupdates.available")); if (await is_running.game()) { - console.log(lang("cli.autoupdates.gamerunning")); + console.log(lang("general.autoupdates.gamerunning")); new Notification({ title: lang("gui.nsupdate.gaming.title"), body: lang("gui.nsupdate.gaming.body") @@ -150,7 +150,7 @@ update.viper = (autoinstall) => { // unzip module does not support excluding files directly. update.northstar = async () => { if (await is_running.game()) { - console.log(lang("cli.autoupdates.gamerunning")); + console.log(lang("general.autoupdates.gamerunning")); return false; } |