diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 17:33:37 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 17:33:37 +0200 |
commit | 1aa1c19541f472ebf3cd2354a7969e5fb43d2305 (patch) | |
tree | f1a5a9d72344a71c514d4c409678540efda50633 /src-ui | |
parent | dc44b1e245f8eac6a6ea2c46262d61de793de011 (diff) | |
download | FlightCore-1aa1c19541f472ebf3cd2354a7969e5fb43d2305.tar.gz FlightCore-1aa1c19541f472ebf3cd2354a7969e5fb43d2305.zip |
Return result error type if TF|2 install not found
Diffstat (limited to 'src-ui')
-rw-r--r-- | src-ui/src/main.ts | 37 |
1 files changed, 23 insertions, 14 deletions
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; + }); }) |