diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-11 00:32:55 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-11 00:32:55 +0200 |
commit | 504c1bc00e9d27a3df9a300ba2ebd8aa9efbb3ab (patch) | |
tree | bb3785aa3f4f8d03c1e245e73c8435b06c69c1ce /src-tauri/src | |
parent | 6097f17765e5f4303a25f58e1ad07b5dbb79233b (diff) | |
download | FlightCore-504c1bc00e9d27a3df9a300ba2ebd8aa9efbb3ab.tar.gz FlightCore-504c1bc00e9d27a3df9a300ba2ebd8aa9efbb3ab.zip |
Check if Origin is running
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/lib.rs | 11 | ||||
-rw-r--r-- | src-tauri/src/main.rs | 11 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 9a3cd471..61b4fb65 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -288,3 +288,14 @@ pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> { get_host_os() )) } + +use sysinfo::{System, SystemExt}; +pub fn check_origin_running() -> bool { + let s = System::new_all(); + for _process in s.processes_by_name("Origin.exe") { + // check here if this is your process + // dbg!(process); + return true; + } + false +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 97c77fa4..fd171468 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -10,7 +10,7 @@ use std::{ }; use app::{ - check_is_valid_game_path, find_game_install_location, get_host_os, + check_is_valid_game_path, check_origin_running, find_game_install_location, get_host_os, get_northstar_version_number, install_northstar, launch_northstar, GameInstall, }; use tauri::{Manager, State}; @@ -40,6 +40,15 @@ fn main() { app_handle.emit_all("backend-ping", "ping").unwrap(); } }); + let app_handle = app.app_handle(); + tauri::async_runtime::spawn(async move { + loop { + sleep(Duration::from_millis(2000)).await; + app_handle + .emit_all("origin-running-ping", check_origin_running()) + .unwrap(); + } + }); Ok(()) }) |