aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-tauri/src/main.rs8
-rw-r--r--src-ui/src/main.ts15
2 files changed, 15 insertions, 8 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 60b434fc..0b22eaff 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -113,7 +113,7 @@ fn get_northstar_version_number_caller(game_path: String) -> String {
/// Checks if installed Northstar version is up-to-date
/// false -> Northstar install is up-to-date
/// true -> Northstar install is outdated
-async fn check_is_northstar_outdated(game_path: String) -> bool {
+async fn check_is_northstar_outdated(game_path: String) -> Result<bool, String> {
let index = thermite::api::get_package_index().await.unwrap().to_vec();
let nmod = index
.iter()
@@ -128,16 +128,16 @@ async fn check_is_northstar_outdated(game_path: String) -> bool {
Err(err) => {
println!("{}", err);
// If we fail to get new version just assume we are up-to-date
- return false;
+ return Err(err.to_string());
}
};
if version_number != nmod.version {
println!("Installed Northstar version outdated");
- true
+ Ok(true)
} else {
println!("Installed Northstar version up-to-date");
- false
+ Ok(false)
}
}
diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts
index 3b2d2f7d..e733cf4d 100644
--- a/src-ui/src/main.ts
+++ b/src-ui/src/main.ts
@@ -21,10 +21,17 @@ async function get_northstar_version_number_and_set_button_accordingly(omniButto
if (northstar_version_number && northstar_version_number.length > 0) {
globalState.installed_northstar_version = northstar_version_number;
omniButtonEl.textContent = `${button_play_string} (${northstar_version_number})`;
- let northstar_is_outdated = await invoke("check_is_northstar_outdated", { gamePath: globalState.gamepath }) as boolean;
- if (northstar_is_outdated) {
- omniButtonEl.textContent = button_update_string;
- }
+ await invoke("check_is_northstar_outdated", { gamePath: globalState.gamepath })
+ .then((message) => {
+ console.log(message);
+ if (message) {
+ omniButtonEl.textContent = button_update_string;
+ }
+ })
+ .catch((error) => {
+ console.error(error);
+ alert(error);
+ });
}
}