Remove mod #11

This commit is contained in:
Kr4ight
2026-04-05 17:16:09 +02:00
parent 167bb33144
commit 7167211f06
4 changed files with 40 additions and 2 deletions
+20
View File
@@ -105,6 +105,26 @@ fn fallback_mod(file_name: &str, enabled: bool) -> Mod {
}
}
#[tauri::command]
pub async fn remove_mod(version: String, file_name: String) -> Result<(), String> {
// mods folder
let mods_dir: PathBuf = LAUNCHER_DIR.data_dir().join(&version).join("mods");
// File to remove
let source = mods_dir.join(&file_name);
if !source.exists() {
return Err(format!("Mod file not found: {}", file_name));
}
// move file
fs::remove_file(&source)
.await
.map_err(|e| e.to_string())?;
Ok(())
}
#[tauri::command]
pub async fn disable_mod(version: String, file_name: String) -> Result<(), String> {
// mods folder
+2 -1
View File
@@ -12,9 +12,10 @@ fn main() {
.invoke_handler(tauri::generate_handler![
// Saturn Launcher Commands
saturn_launcher_lib::commands::get_installed_mods,
saturn_launcher_lib::commands::install_mod,
saturn_launcher_lib::commands::enable_mod,
saturn_launcher_lib::commands::disable_mod,
saturn_launcher_lib::commands::install_mod,
saturn_launcher_lib::commands::remove_mod,
saturn_launcher_lib::commands::get_settings,
saturn_launcher_lib::commands::update_settings,
saturn_launcher_lib::commands::get_version,