aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/util.rs
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-05-13 14:36:35 +0200
committerGitHub <noreply@github.com>2023-05-13 14:36:35 +0200
commit3ee065407d57c424248457b567e1b3399002b443 (patch)
tree446b388c330386bb23361846ffd245ac1fc2f4ee /src-tauri/src/util.rs
parent726b7466b34a936205a32098c56b7c723db34862 (diff)
downloadFlightCore-3ee065407d57c424248457b567e1b3399002b443.tar.gz
FlightCore-3ee065407d57c424248457b567e1b3399002b443.zip
refactor: Move Origin/NS running check to util mod (#355)
Diffstat (limited to 'src-tauri/src/util.rs')
-rw-r--r--src-tauri/src/util.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rs
index 93844af5..c5433fcd 100644
--- a/src-tauri/src/util.rs
+++ b/src-tauri/src/util.rs
@@ -2,6 +2,7 @@
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
+use sysinfo::SystemExt;
use zip::ZipArchive;
use crate::constants::{APP_USER_AGENT, MASTER_SERVER_URL, SERVER_BROWSER_ENDPOINT};
@@ -103,3 +104,21 @@ pub fn extract(zip_file: std::fs::File, target: &std::path::Path) -> Result<()>
Ok(())
}
+
+pub fn check_origin_running() -> bool {
+ let s = sysinfo::System::new_all();
+ let x = s.processes_by_name("Origin.exe").next().is_some()
+ || s.processes_by_name("EADesktop.exe").next().is_some();
+ x
+}
+
+/// Checks if Northstar process is running
+pub fn check_northstar_running() -> bool {
+ let s = sysinfo::System::new_all();
+ let x = s
+ .processes_by_name("NorthstarLauncher.exe")
+ .next()
+ .is_some()
+ || s.processes_by_name("Titanfall2.exe").next().is_some();
+ x
+}