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