aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2024-01-12 15:04:03 +0100
committerGeckoEidechse <gecko.eidechse+git@pm.me>2024-01-12 15:04:03 +0100
commit0221d01aa7b2e35e29c9d60bbd5ef9083541c862 (patch)
treed0ff60656ec3132738d3d71de22df2c899b5ded6 /src-tauri
parenta7c68f0a208b3fdcd29b9ed415c3da9fb6356957 (diff)
downloadFlightCore-0221d01aa7b2e35e29c9d60bbd5ef9083541c862.tar.gz
FlightCore-0221d01aa7b2e35e29c9d60bbd5ef9083541c862.zip
temp: Commit working treefeat/cleanup-remote-mods
Still needs to actually delete the folder
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/main.rs1
-rw-r--r--src-tauri/src/repair_and_verify/mod.rs35
2 files changed, 36 insertions, 0 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 09242680..5afa2335 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -130,6 +130,7 @@ fn main() {
github::release_notes::check_is_flightcore_outdated,
repair_and_verify::get_log_list,
repair_and_verify::verify_game_files,
+ repair_and_verify::delete_remote_mods,
mod_management::set_mod_enabled_status,
repair_and_verify::disable_all_but_core,
util::is_debug_mode,
diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs
index c752a3ab..606998a2 100644
--- a/src-tauri/src/repair_and_verify/mod.rs
+++ b/src-tauri/src/repair_and_verify/mod.rs
@@ -136,3 +136,38 @@ pub fn get_log_list(game_install: GameInstall) -> Result<Vec<std::path::PathBuf>
Err("No logs found".to_string())
}
}
+
+/// TODO
+#[tauri::command]
+pub fn delete_remote_mods(game_install: GameInstall) -> Result<(), String> {
+ // Get remote mods folder
+ let ns_remote_mod_folder = format!(
+ "{}/{}/runtime/remote/mods/",
+ game_install.game_path, game_install.profile
+ ); // TODO double check
+
+ // Safety check
+ let path_to_delete = std::path::Path::new(&ns_remote_mod_folder);
+
+ // Check if path even exists before we attempt to remove
+ if !path_to_delete.exists() {
+ log::info!(
+ "{} does not exist. Nothing to do here",
+ ns_remote_mod_folder
+ );
+ return Ok(());
+ }
+
+ if !path_to_delete.is_dir() {
+ let error_message = format!(
+ "{} exists but is a file? This should never happen",
+ ns_remote_mod_folder
+ );
+ log::error!("{}", error_message);
+ return Err(error_message);
+ }
+
+ // Delete
+ // TODO
+ Err("TODO".to_string())
+}