aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2022-08-29 01:00:10 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-08-29 01:00:10 +0200
commit9a23a8d68cfa3477b55778818d7d06b468f9b5ca (patch)
tree551c1de1de39997858d69258091e83a67e12057b /src-tauri
parentdd4f758daf0203e31d87da2e3fbdee4f09540828 (diff)
downloadFlightCore-9a23a8d68cfa3477b55778818d7d06b468f9b5ca.tar.gz
FlightCore-9a23a8d68cfa3477b55778818d7d06b468f9b5ca.zip
Get game install location on application load
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/main.rs16
1 files changed, 2 insertions, 14 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 7fd7bf2e..79386ca6 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -36,20 +36,6 @@ fn main() {
}
});
- let app_handle = app.app_handle();
- tauri::async_runtime::spawn(async move {
- // Checking install location inside a timed loop is a bad idea
- // If the user has the game on a harddrive for example, it will prevent the harddrive from ever spinning down
- // Instead, install location checks should be event based.
- loop {
- sleep(Duration::from_millis(5000)).await;
- println!("sending install location");
- app_handle
- .emit_all("install-location-result", find_game_install_location())
- .unwrap();
- }
- });
-
Ok(())
})
.manage(Counter(Default::default()))
@@ -57,12 +43,14 @@ fn main() {
hello_world,
add_count,
force_panic,
+ find_game_install_location,
get_version_number
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
+#[tauri::command]
fn find_game_install_location() -> String {
// Attempt parsing Steam library directly
match steamlocate::SteamDir::locate() {