aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/repair_and_verify
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2022-10-02 22:52:39 +0200
committerGitHub <noreply@github.com>2022-10-02 22:52:39 +0200
commita4b14e2c0edbbae1d399009ad9d691e7c30d4571 (patch)
tree7585d1bc1e54319710881e2a310f6825f622d437 /src-tauri/src/repair_and_verify
parent96f83ec9406e330444e5f0ab135dc4c169c832ce (diff)
parent7f0ee9be80988f13f1d234136725a03db0335ec5 (diff)
downloadFlightCore-a4b14e2c0edbbae1d399009ad9d691e7c30d4571.tar.gz
FlightCore-a4b14e2c0edbbae1d399009ad9d691e7c30d4571.zip
Merge branch 'GeckoEidechse:main' into feat/new-ui
Diffstat (limited to 'src-tauri/src/repair_and_verify')
-rw-r--r--src-tauri/src/repair_and_verify/mod.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs
index e99dcbfc..39df916c 100644
--- a/src-tauri/src/repair_and_verify/mod.rs
+++ b/src-tauri/src/repair_and_verify/mod.rs
@@ -1,9 +1,35 @@
/// Contains various functions to repair common issues and verifying installation
-use app::GameInstall;
+use app::{get_enabled_mods, set_mod_enabled_status, GameInstall};
/// Verifies Titanfall2 game files
pub fn verify_game_files(game_install: GameInstall) -> Result<String, String> {
dbg!(game_install);
Err("TODO, not yet implemented".to_string())
}
+
+/// Disables all mods except core ones
+/// Enables core mods if disabled
+pub fn disable_all_but_core(game_install: GameInstall) -> Result<(), String> {
+ let current_mods = get_enabled_mods(game_install.clone())?;
+
+ // These are the mods we do not want to disable
+ let core_mods = [
+ "Northstar.Client",
+ "Northstar.Custom",
+ "Northstar.CustomServers",
+ ];
+ // let sub_values: Vec<HashMap<String, Value>> = serde_json::from_str(&json)?;
+
+ for (key, _value) in current_mods.as_object().unwrap() {
+ if core_mods.contains(&key.as_str()) {
+ // This is a core mod
+ set_mod_enabled_status(game_install.clone(), key.to_string(), true)?;
+ } else {
+ // Not a core mod
+ set_mod_enabled_status(game_install.clone(), key.to_string(), false)?;
+ }
+ }
+
+ Ok(())
+}