diff options
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/lib.rs | 11 | ||||
-rw-r--r-- | src-tauri/src/main.rs | 15 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index f2fef1da..9856394d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -334,6 +334,17 @@ pub fn check_origin_running() -> bool { false } +/// Checks if Northstar process is running +pub fn check_northstar_running() -> bool { + let s = sysinfo::System::new_all(); + for _process in s.processes_by_name("NorthstarLauncher.exe") { + // check here if this is your process + // dbg!(process); + return true; + } + false +} + /// Helps with converting release candidate numbers which are different on Thunderstore /// due to restrictions imposed by the platform pub fn convert_release_candidate_number(version_number: String) -> String { diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 20ad4716..c6c51e2b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -10,9 +10,9 @@ use std::{ }; use app::{ - check_is_flightcore_outdated, check_is_valid_game_path, check_origin_running, - convert_release_candidate_number, find_game_install_location, get_host_os, - get_northstar_version_number, install_northstar, launch_northstar, GameInstall, + check_is_flightcore_outdated, check_is_valid_game_path, check_northstar_running, + check_origin_running, convert_release_candidate_number, find_game_install_location, + get_host_os, get_northstar_version_number, install_northstar, launch_northstar, GameInstall, }; use tauri::{Manager, State}; use tokio::time::sleep; @@ -50,6 +50,15 @@ fn main() { .unwrap(); } }); + let app_handle = app.app_handle(); + tauri::async_runtime::spawn(async move { + loop { + sleep(Duration::from_millis(2000)).await; + app_handle + .emit_all("northstar-running-ping", check_northstar_running()) + .unwrap(); + } + }); Ok(()) }) |