diff options
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/src/main.rs | 54 | ||||
-rw-r--r-- | src-tauri/src/northstar/install.rs | 43 |
2 files changed, 45 insertions, 52 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 32804192..6b0425cd 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -124,8 +124,8 @@ fn main() { check_is_northstar_outdated, verify_install_location, platform_specific::get_host_os, - install_northstar_wrapper, - update_northstar, + northstar::install::install_northstar_wrapper, + northstar::install::update_northstar, northstar::launch_northstar, northstar::launch_northstar_steam, github::release_notes::check_is_flightcore_outdated, @@ -278,56 +278,6 @@ async fn verify_install_location(game_path: String) -> bool { } } -/// Installs Northstar to the given path -#[tauri::command] -async fn install_northstar_wrapper( - window: tauri::Window, - game_install: GameInstall, - northstar_package_name: Option<String>, - version_number: Option<String>, -) -> Result<bool, String> { - log::info!("Running Northstar install"); - - // Get Northstar package name (`Northstar` vs `NorthstarReleaseCandidate`) - let northstar_package_name = northstar_package_name - .map(|name| { - if name.len() <= 1 { - "Northstar".to_string() - } else { - name - } - }) - .unwrap_or("Northstar".to_string()); - - match northstar::install::install_northstar( - window, - game_install, - northstar_package_name, - version_number, - ) - .await - { - Ok(_) => Ok(true), - Err(err) => { - log::error!("{}", err); - Err(err) - } - } -} - -/// Update Northstar install in the given path -#[tauri::command] -async fn update_northstar( - window: tauri::Window, - game_install: GameInstall, - northstar_package_name: Option<String>, -) -> Result<bool, String> { - log::info!("Updating Northstar"); - - // Simply re-run install with up-to-date version for upate - install_northstar_wrapper(window, game_install, northstar_package_name, None).await -} - /// Installs the specified mod #[tauri::command] async fn install_mod_wrapper( diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index 757f6c68..693d7af2 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -29,6 +29,49 @@ struct InstallProgress { state: InstallState, } +/// Installs Northstar to the given path +#[tauri::command] +pub async fn install_northstar_wrapper( + window: tauri::Window, + game_install: GameInstall, + northstar_package_name: Option<String>, + version_number: Option<String>, +) -> Result<bool, String> { + log::info!("Running Northstar install"); + + // Get Northstar package name (`Northstar` vs `NorthstarReleaseCandidate`) + let northstar_package_name = northstar_package_name + .map(|name| { + if name.len() <= 1 { + "Northstar".to_string() + } else { + name + } + }) + .unwrap_or("Northstar".to_string()); + + match install_northstar(window, game_install, northstar_package_name, version_number).await { + Ok(_) => Ok(true), + Err(err) => { + log::error!("{}", err); + Err(err) + } + } +} + +/// Update Northstar install in the given path +#[tauri::command] +pub async fn update_northstar( + window: tauri::Window, + game_install: GameInstall, + northstar_package_name: Option<String>, +) -> Result<bool, String> { + log::info!("Updating Northstar"); + + // Simply re-run install with up-to-date version for upate + install_northstar_wrapper(window, game_install, northstar_package_name, None).await +} + /// Copied from `papa` source code and modified ///Install N* from the provided mod /// |