diff options
-rw-r--r-- | src-tauri/src/main.rs | 4 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 14 | ||||
-rw-r--r-- | src-vue/src/plugins/store.ts | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 476ee9cf..e1d99f61 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -234,7 +234,7 @@ pub fn convert_release_candidate_number(version_number: String) -> String { /// true -> Northstar install is outdated #[tauri::command] async fn check_is_northstar_outdated( - game_path: String, + game_install: GameInstall, northstar_package_name: Option<String>, ) -> Result<bool, String> { let northstar_package_name = match northstar_package_name { @@ -258,7 +258,7 @@ async fn check_is_northstar_outdated( .expect("Couldn't find Northstar on thunderstore???"); // .ok_or_else(|| anyhow!("Couldn't find Northstar on thunderstore???"))?; - let version_number = match northstar::get_northstar_version_number(&game_path) { + let version_number = match northstar::get_northstar_version_number(game_install) { Ok(version_number) => version_number, Err(err) => { log::warn!("{}", err); diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index 85d792d6..173495c6 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -26,15 +26,14 @@ pub fn check_mod_version_number(path_to_mod_folder: &str) -> Result<String, anyh /// Returns the current Northstar version number as a string #[tauri::command] -pub fn get_northstar_version_number(game_path: &str) -> Result<String, String> { - log::info!("{}", game_path); +pub fn get_northstar_version_number(game_install: GameInstall) -> Result<String, String> { + log::info!("{}", game_install.game_path); // TODO: // Check if NorthstarLauncher.exe exists and check its version number - let profile_folder = "R2Northstar"; let initial_version_number = match check_mod_version_number(&format!( - "{game_path}/{profile_folder}/mods/{}", - CORE_MODS[0] + "{}/{}/mods/{}", + game_install.game_path, game_install.profile, CORE_MODS[0] )) { Ok(version_number) => version_number, Err(err) => return Err(err.to_string()), @@ -42,7 +41,8 @@ pub fn get_northstar_version_number(game_path: &str) -> Result<String, String> { for core_mod in CORE_MODS { let current_version_number = match check_mod_version_number(&format!( - "{game_path}/{profile_folder}/mods/{core_mod}", + "{}/{}/mods/{}", + game_install.game_path, game_install.profile, core_mod )) { Ok(version_number) => version_number, Err(err) => return Err(err.to_string()), @@ -85,7 +85,7 @@ pub fn launch_northstar( // Only check guards if bypassing checks is not enabled if !bypass_checks { // Some safety checks before, should have more in the future - if get_northstar_version_number(&game_install.game_path).is_err() { + if get_northstar_version_number(game_install.clone()).is_err() { return Err(anyhow!("Not all checks were met").to_string()); } diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 2991ad1d..aee8bbce 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -465,13 +465,13 @@ function _initializeListeners(state: any) { * state, for it to be displayed in UI. */ async function _get_northstar_version_number(state: any) { - await invoke("get_northstar_version_number", { gamePath: state.game_install.game_path }) + await invoke("get_northstar_version_number", { gameInstall: state.game_install }) .then((message) => { let northstar_version_number: string = message as string; state.installed_northstar_version = northstar_version_number; state.northstar_state = NorthstarState.READY_TO_PLAY; - invoke("check_is_northstar_outdated", { gamePath: state.game_install.game_path, northstarPackageName: state.northstar_release_canal }) + invoke("check_is_northstar_outdated", { gameInstall: state.game_install, northstarPackageName: state.northstar_release_canal }) .then((message) => { if (message) { state.northstar_state = NorthstarState.MUST_UPDATE; |