Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Delete old version when updating mod #401

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 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,17 @@ 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