Skip to content

Commit

Permalink
feat: Delete old version when updating mod
Browse files Browse the repository at this point in the history
Deletes all Northstar mods based on Thunderstore mod string before
installing new version.

This way we can clean up old files from mods before installing new
version
  • Loading branch information
GeckoEidechse committed Jun 29, 2023
1 parent 46260b9 commit 020dc90
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src-tauri/src/mod_management/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,18 @@ pub async fn fc_download_mod_and_install(
// Get Thunderstore mod author
let author = thunderstore_mod_string.split('-').next().unwrap();

// Delete previous version of mod if already installed
// This way we ensure that any old files/folders are removed
match delete_thunderstore_mod(game_install.clone(), thunderstore_mod_string.to_string()) {
Ok(()) => (),
Err(err) => {
// Error can include the mod being found installed cause this is the first time it's being installed
// As such we just ignore any error (but still log it just in case)
log::info!("{err}");
()
}
};

// Extract the mod to the mods directory
match thermite::core::manage::install_mod(
author,
Expand Down

0 comments on commit 020dc90

Please sign in to comment.