aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-tauri/src/mod_management/legacy.rs13
-rw-r--r--src-tauri/src/mod_management/mod.rs17
2 files changed, 29 insertions, 1 deletions
diff --git a/src-tauri/src/mod_management/legacy.rs b/src-tauri/src/mod_management/legacy.rs
index 3136a618..cf535000 100644
--- a/src-tauri/src/mod_management/legacy.rs
+++ b/src-tauri/src/mod_management/legacy.rs
@@ -88,7 +88,7 @@ pub fn parse_installed_mods(
}
};
// Get Thunderstore mod string if it exists
- let thunderstore_mod_string = match parsed_mod_json.thunderstore_mod_string {
+ let mut thunderstore_mod_string = match parsed_mod_json.thunderstore_mod_string {
// Attempt legacy method for getting Thunderstore string first
Some(ts_mod_string) => Some(ts_mod_string),
// Legacy method failed
@@ -100,6 +100,17 @@ pub fn parse_installed_mods(
// Get directory path
let mod_directory = directory.to_str().unwrap().to_string();
+ // This is a stupid way to show a legacy installed mod as outdated by simply giving back a wrong version number
+ if thunderstore_mod_string.is_some() {
+ // Parse the string
+ let mut parsed_string: ParsedThunderstoreModString =
+ thunderstore_mod_string.clone().unwrap().parse().unwrap();
+ // Set version number to `0.0.0`
+ parsed_string.version = "0.0.0".to_string();
+ // And store new string back in original variable
+ thunderstore_mod_string = Some(parsed_string.to_string())
+ }
+
let ns_mod = NorthstarMod {
name: parsed_mod_json.name,
version: parsed_mod_json.version,
diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs
index cef7ff71..00a4987b 100644
--- a/src-tauri/src/mod_management/mod.rs
+++ b/src-tauri/src/mod_management/mod.rs
@@ -615,6 +615,23 @@ pub async fn fc_download_mod_and_install(
}
};
+ // Successful package install
+ match legacy::delete_legacy_package_install(thunderstore_mod_string, game_install) {
+ Ok(()) => (),
+ Err(err) => {
+ // Catch error but ignore
+ log::warn!("Failed deleting legacy versions due to: {}", err);
+ }
+ };
+
+ match delete_older_versions(thunderstore_mod_string, game_install) {
+ Ok(()) => (),
+ Err(err) => {
+ // Catch error but ignore
+ log::warn!("Failed deleting older versions due to: {}", err);
+ }
+ };
+
Ok(())
}