diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-14 18:40:31 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-14 18:40:31 +0200 |
commit | 5fd674a48bfa7d36ec3e59cd703eb0ec0e363c7d (patch) | |
tree | 939de835255a89c36347e19613d8f4b24a603a27 | |
parent | ca9db96131d056dbff0fb7f1e1acec8d57486f87 (diff) | |
download | FlightCore-5fd674a48bfa7d36ec3e59cd703eb0ec0e363c7d.tar.gz FlightCore-5fd674a48bfa7d36ec3e59cd703eb0ec0e363c7d.zip |
Use variable instead of hard-coded string
-rw-r--r-- | src-tauri/src/lib.rs | 4 | ||||
-rw-r--r-- | src-tauri/src/main.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 0e8adbf0..df83de80 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -233,10 +233,12 @@ async fn do_install(nmod: &thermite::model::Mod, game_path: &std::path::Path) -> } pub async fn install_northstar(game_path: &str) -> Result<String> { + let northstar_package_name = "Northstar".to_lowercase(); + let index = thermite::api::get_package_index().await.unwrap().to_vec(); let nmod = index .iter() - .find(|f| f.name.to_lowercase() == "northstar") + .find(|f| f.name.to_lowercase() == northstar_package_name) .ok_or_else(|| panic!("Couldn't find Northstar on thunderstore???")) .unwrap(); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 85b0fa3d..85082774 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -125,10 +125,12 @@ fn get_northstar_version_number_caller(game_path: String) -> String { /// false -> Northstar install is up-to-date /// true -> Northstar install is outdated async fn check_is_northstar_outdated(game_path: String) -> Result<bool, String> { + let northstar_package_name = "Northstar".to_lowercase(); + let index = thermite::api::get_package_index().await.unwrap().to_vec(); let nmod = index .iter() - .find(|f| f.name.to_lowercase() == "northstar") + .find(|f| f.name.to_lowercase() == northstar_package_name.to_lowercase()) .expect("Couldn't find Northstar on thunderstore???"); // .ok_or_else(|| anyhow!("Couldn't find Northstar on thunderstore???"))?; |