From 8d40bca06dc8eea63c5eb7e4ae93f38e29654c7b Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 27 Nov 2022 20:35:11 +0100 Subject: refactor: Make var containing core mods pub const (#74) This way we only define them in one place --- src-tauri/src/repair_and_verify/mod.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src-tauri/src/repair_and_verify') diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs index 32715622..47ec4cc9 100644 --- a/src-tauri/src/repair_and_verify/mod.rs +++ b/src-tauri/src/repair_and_verify/mod.rs @@ -1,7 +1,7 @@ /// Contains various functions to repair common issues and verifying installation use app::{get_enabled_mods, GameInstall}; -use crate::mod_management::set_mod_enabled_status; +use crate::{mod_management::set_mod_enabled_status, northstar::CORE_MODS}; use anyhow::anyhow; /// Verifies Titanfall2 game files @@ -15,17 +15,10 @@ pub fn verify_game_files(game_install: GameInstall) -> Result { 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> = serde_json::from_str(&json)?; - + // Disable all mods, set core mods to enabled for (key, _value) in current_mods.as_object().unwrap() { - if core_mods.contains(&key.as_str()) { - // This is a core mod + if CORE_MODS.contains(&key.as_str()) { + // This is a core mod, we do not want to disable it set_mod_enabled_status(game_install.clone(), key.to_string(), true)?; } else { // Not a core mod -- cgit v1.2.3