diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-14 23:56:09 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-14 23:56:09 +0200 |
commit | 17a1e8a5edfd2dfb4bc89e619c5e27721473ee1e (patch) | |
tree | ad16d13f2143836be7fc6cf0ec9df77548524b44 /src-tauri/src/lib.rs | |
parent | 7899a99d89bfd5f9fea52e9cdb01f367e2ccef3b (diff) | |
download | FlightCore-17a1e8a5edfd2dfb4bc89e619c5e27721473ee1e.tar.gz FlightCore-17a1e8a5edfd2dfb4bc89e619c5e27721473ee1e.zip |
Support switching between main release and RCs
State is not saved between launches currently.
Diffstat (limited to 'src-tauri/src/lib.rs')
-rw-r--r-- | src-tauri/src/lib.rs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 63f57cd4..c74579d7 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -232,8 +232,20 @@ async fn do_install(nmod: &thermite::model::Mod, game_path: &std::path::Path) -> Ok(()) } -pub async fn install_northstar(game_path: &str) -> Result<String> { - let northstar_package_name = "Northstar".to_lowercase(); +pub async fn install_northstar( + game_path: &str, + northstar_package_name: Option<String>, +) -> Result<String> { + let northstar_package_name = match northstar_package_name { + Some(northstar_package_name) => { + if northstar_package_name.len() <= 1 { + "Northstar".to_string() + } else { + northstar_package_name + } + } + None => "Northstar".to_string(), + }; let index = thermite::api::get_package_index().await.unwrap().to_vec(); let nmod = index @@ -321,3 +333,12 @@ pub fn check_origin_running() -> bool { } false } + +/// Helps with converting release candidate numbers which are different on Thunderstore +/// due to restrictions imposed by the platform +pub fn convert_release_candidate_number(version_number: String) -> String { + // This simply converts `-rc` to `0` + // Works as intended for RCs < 10, e.g. `v1.9.2-rc1` -> `v1.9.201` + // Doesn't work for larger numbers, e.g. `v1.9.2-rc11` -> `v1.9.2011` (should be `v1.9.211`) + version_number.replace("-rc", "0") +} |