diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2023-02-11 18:33:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-11 18:33:15 +0100 |
commit | fc00447ccc3f63a54faca3d666701c19d9b8b8db (patch) | |
tree | 501b8f6691f096d3cb69a8a3a2cb5681fa5acebf /src-tauri/src | |
parent | fd4712accb319cd0084f7e97fea4d9d1299d8938 (diff) | |
download | FlightCore-fc00447ccc3f63a54faca3d666701c19d9b8b8db.tar.gz FlightCore-fc00447ccc3f63a54faca3d666701c19d9b8b8db.zip |
refactor: Move various consts to `constants.rs` (#162)
* refactor: Move list of core mods to consts source
Move the list of core Northstar mods to constants.rs
* fix: Add missing newline
* refactor: Move list of blacklisted mods to consts
source file
* refactor: Move list of TF2 Origin IDs to consts
source file
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/constants.rs | 18 | ||||
-rw-r--r-- | src-tauri/src/mod_management/mod.rs | 10 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 8 | ||||
-rw-r--r-- | src-tauri/src/platform_specific/windows.rs | 4 | ||||
-rw-r--r-- | src-tauri/src/repair_and_verify/mod.rs | 7 |
5 files changed, 24 insertions, 23 deletions
diff --git a/src-tauri/src/constants.rs b/src-tauri/src/constants.rs index 79c93f61..73cb6fb3 100644 --- a/src-tauri/src/constants.rs +++ b/src-tauri/src/constants.rs @@ -10,3 +10,21 @@ pub const MASTER_SERVER_URL: &str = "https://northstar.tf"; // server list endpoint pub const SERVER_BROWSER_ENDPOINT: &str = "/client/servers"; + +// List of core Northstar mods +pub const CORE_MODS: [&str; 3] = [ + "Northstar.Client", + "Northstar.Custom", + "Northstar.CustomServers", +]; + +// List of Thunderstoremods that shouldn't be installable +// as they behave different than common Squirrel mods +pub const BLACKLISTED_MODS: [&str; 3] = [ + "northstar-Northstar", + "northstar-NorthstarReleaseCandidate", + "ebkr-r2modman", +]; + +// Titanfall2 game IDs on Origin/EA-App +pub const TITANFALL2_ORIGIN_IDS: [&str; 2] = ["Origin.OFR.50.0001452", "Origin.OFR.50.0001456"]; diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index 75d63972..d2b5040b 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -1,4 +1,6 @@ // This file contains various mod management functions + +use app::constants::{BLACKLISTED_MODS, CORE_MODS}; use async_recursion::async_recursion; use anyhow::{anyhow, Result}; @@ -12,14 +14,6 @@ use app::GameInstall; use json5; -use crate::northstar::CORE_MODS; - -pub const BLACKLISTED_MODS: [&str; 3] = [ - "northstar-Northstar", - "northstar-NorthstarReleaseCandidate", - "ebkr-r2modman", -]; - #[derive(Debug, Clone)] struct ParsedThunderstoreModString { author_name: String, diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index 8adfeec2..a043632c 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -1,13 +1,7 @@ //! This module deals with handling things around Northstar such as //! - getting version number -pub const CORE_MODS: [&str; 3] = [ - "Northstar.Client", - "Northstar.Custom", - "Northstar.CustomServers", -]; - -use crate::check_mod_version_number; +use crate::{check_mod_version_number, constants::CORE_MODS}; use anyhow::anyhow; /// Returns the current Northstar version number as a string diff --git a/src-tauri/src/platform_specific/windows.rs b/src-tauri/src/platform_specific/windows.rs index ad2ba6df..21772b91 100644 --- a/src-tauri/src/platform_specific/windows.rs +++ b/src-tauri/src/platform_specific/windows.rs @@ -1,9 +1,7 @@ /// Windows specific code use anyhow::{anyhow, Result}; -use crate::check_is_valid_game_path; - -const TITANFALL2_ORIGIN_IDS: [&str; 2] = ["Origin.OFR.50.0001452", "Origin.OFR.50.0001456"]; +use crate::{check_is_valid_game_path, constants::TITANFALL2_ORIGIN_IDS}; /// Runs a powershell command and parses output to get Titanfall2 install location on Origin pub fn origin_install_location_detection() -> Result<String, anyhow::Error> { diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs index 5d58dfaf..9d020f15 100644 --- a/src-tauri/src/repair_and_verify/mod.rs +++ b/src-tauri/src/repair_and_verify/mod.rs @@ -1,10 +1,7 @@ -use crate::{ - mod_management::{rebuild_enabled_mods_json, set_mod_enabled_status}, - northstar::CORE_MODS, -}; +use crate::mod_management::{rebuild_enabled_mods_json, set_mod_enabled_status}; use anyhow::anyhow; /// Contains various functions to repair common issues and verifying installation -use app::{get_enabled_mods, GameInstall}; +use app::{constants::CORE_MODS, get_enabled_mods, GameInstall}; /// Verifies Titanfall2 game files #[tauri::command] |