diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-20 15:35:49 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-20 15:35:49 +0200 |
commit | 3abf70c34f5a354afd89b10017ffda05aad4e54f (patch) | |
tree | 71da71c7aece0d8efb80747b1257d39e48f83b88 /src-tauri/src/main.rs | |
parent | 120d6834eeeabd77cab490bfd2e6afcf889b233f (diff) | |
download | FlightCore-3abf70c34f5a354afd89b10017ffda05aad4e54f.tar.gz FlightCore-3abf70c34f5a354afd89b10017ffda05aad4e54f.zip |
Periodically check if Northstar is running
Diffstat (limited to 'src-tauri/src/main.rs')
-rw-r--r-- | src-tauri/src/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
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(()) }) |