diff options
-rw-r--r-- | src-tauri/src/main.rs | 6 | ||||
-rw-r--r-- | src-ui/src/main.ts | 16 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 733da602..60b434fc 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -161,13 +161,13 @@ fn get_host_os() -> String { #[tauri::command] /// Installs Northstar to the given path -async fn install_northstar_caller(game_path: String) -> bool { +async fn install_northstar_caller(game_path: String) -> Result<bool, String> { println!("Running"); match install_northstar(&game_path).await { - Ok(_) => true, + Ok(_) => Ok(true), Err(err) => { println!("{}", err); - false + Err(err.to_string()) } } } diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index 39ddf2dd..3b2d2f7d 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -94,9 +94,19 @@ document.addEventListener("DOMContentLoaded", async function () { break; // Install Northstar case button_install_string: - omniButtonEl.textContent = "Installing"; - await invoke("install_northstar_caller", { gamePath: globalState.gamepath }) as boolean; - alert("Done?"); + let install_northstar_result = invoke("install_northstar_caller", { gamePath: globalState.gamepath }); + + // Update button while installl process is run + omniButtonEl.textContent = "Installing..."; + + await install_northstar_result.then((message) => { + console.log(message); + alert("Done installing Northstar"); + }) + .catch((error) => { + console.error(error); + alert(error); + }); get_northstar_version_number_and_set_button_accordingly(omniButtonEl); break; |