aboutsummaryrefslogtreecommitdiff
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
parenta7c68f0a208b3fdcd29b9ed415c3da9fb6356957 (diff)
downloadFlightCore-0221d01aa7b2e35e29c9d60bbd5ef9083541c862.tar.gz
FlightCore-0221d01aa7b2e35e29c9d60bbd5ef9083541c862.zip
temp: Commit working treefeat/cleanup-remote-mods
Still needs to actually delete the folder
-rw-r--r--src-tauri/src/main.rs1
-rw-r--r--src-tauri/src/repair_and_verify/mod.rs35
-rw-r--r--src-vue/src/views/RepairView.vue14
3 files changed, 50 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())
+}
diff --git a/src-vue/src/views/RepairView.vue b/src-vue/src/views/RepairView.vue
index 341dff2d..8921a70c 100644
--- a/src-vue/src/views/RepairView.vue
+++ b/src-vue/src/views/RepairView.vue
@@ -25,6 +25,11 @@
{{ $t('settings.repair.window.disable_modsettings') }}
</el-button>
+ <el-button type="primary" @click="deleteRemoteMods">
+ {{ $t('settings.repair.window.delete_remote_mods') }}
+ </el-button>
+
+
<h2>FlightCore</h2>
<el-button type="primary" @click="cleanUpDownloadFolder">
@@ -135,6 +140,15 @@ export default defineComponent({
showErrorNotification(error);
});
},
+ async deleteRemoteMods() {
+ await invoke("delete_remote_mods", { gameInstall: this.$store.state.game_install })
+ .then((message) => {
+ showNotification(this.$t('generic.success'));
+ })
+ .catch((error) => {
+ showErrorNotification(error);
+ });
+ },
},
watch: {
// Lang value is propagated to repair view after it's mounted, so we need to watch