diff options
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/main.rs | 26 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 3 | ||||
-rw-r--r-- | src-tauri/src/util.rs | 19 |
3 files changed, 24 insertions, 24 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index ef041024..87f70ae2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -92,7 +92,7 @@ fn main() { loop { sleep(Duration::from_millis(2000)).await; app_handle - .emit_all("origin-running-ping", check_origin_running()) + .emit_all("origin-running-ping", util::check_origin_running()) .unwrap(); } }); @@ -101,7 +101,7 @@ fn main() { loop { sleep(Duration::from_millis(2000)).await; app_handle - .emit_all("northstar-running-ping", check_northstar_running()) + .emit_all("northstar-running-ping", util::check_northstar_running()) .unwrap(); } }); @@ -506,8 +506,6 @@ mod platform_specific; #[cfg(target_os = "linux")] use platform_specific::linux; -use sysinfo::SystemExt; - use crate::constants::TITANFALL2_STEAM_ID; #[derive(Serialize, Deserialize, Debug, Clone)] @@ -642,7 +640,7 @@ pub fn launch_northstar_steam( tauri::async_runtime::spawn(async move { // Starting the EA app and Titanfall might take a good minute or three let mut wait_countdown = 60 * 3; - while wait_countdown > 0 && !check_northstar_running() && !is_err { + while wait_countdown > 0 && !util::check_northstar_running() && !is_err { sleep(Duration::from_millis(1000)).await; wait_countdown -= 1; } @@ -660,21 +658,3 @@ pub fn launch_northstar_steam( retval } - -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 -} diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index c4dc9b82..f210faab 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -2,7 +2,8 @@ //! - getting version number pub mod install; -use crate::{check_origin_running, constants::CORE_MODS, get_host_os, GameInstall, InstallType}; +use crate::util::check_origin_running; +use crate::{constants::CORE_MODS, get_host_os, GameInstall, InstallType}; use anyhow::anyhow; /// Check version number of a mod 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 +} |