aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-tauri/src/main.rs6
-rw-r--r--src-ui/src/main.ts37
2 files changed, 26 insertions, 17 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index bd1aa2d8..34caddc7 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -63,12 +63,12 @@ fn main() {
#[tauri::command]
/// Wrapper for `find_game_install_location` as tauri doesn't allow passing `Result<>` types to front-end
-fn find_game_install_location_caller() -> String {
+fn find_game_install_location_caller() -> Result<String, String> {
match find_game_install_location() {
- Ok((path, install_type)) => path,
+ Ok((path, install_type)) => Ok(path),
Err(err) => {
println!("{}", err);
- "".to_string()
+ Err(err.to_string())
}
}
}
diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts
index 5ebed28e..61fec575 100644
--- a/src-ui/src/main.ts
+++ b/src-ui/src/main.ts
@@ -180,18 +180,27 @@ document.addEventListener("DOMContentLoaded", async function () {
versionNumberHolderEl.textContent = `${version_number_string} (${host_os_string})`;
// Get install location
- let install_location = await invoke("find_game_install_location_caller") as string;
- // Change omni-button content based on whether game install was found
- if (install_location && install_location.length > 0) {
- omniButtonEl.textContent = button_install_string;
- installLocationHolderEl.value = install_location;
- globalState.gamepath = install_location;
-
- // Check installed Northstar version if found
- get_northstar_version_number_and_set_button_accordingly(omniButtonEl);
- console.log(globalState);
- }
- else {
- omniButtonEl.textContent = button_manual_find_string;
- }
+ await invoke("find_game_install_location_caller", { gamePath: globalState.gamepath })
+ .then((game_path) => {
+ // Found some gamepath
+
+ console.log(game_path);
+
+ // Change omni-button content based on whether game install was found
+ let game_path_str = game_path as string
+ omniButtonEl.textContent = button_install_string;
+ installLocationHolderEl.value = game_path_str;
+ globalState.gamepath = game_path_str;
+
+ // Check installed Northstar version if found
+ get_northstar_version_number_and_set_button_accordingly(omniButtonEl);
+ console.log(globalState);
+
+ })
+ .catch((error) => {
+ // Gamepath not found or other error
+ console.error(error);
+ alert(error);
+ omniButtonEl.textContent = button_manual_find_string;
+ });
})