From 26ad6f3ce98e6d345b9f3290d0761e6152d83e07 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Tue, 9 May 2023 16:33:02 +0200 Subject: refactor: Move `get_enabled_mods` to `main.rs` (#333) Part of #329 --- src-tauri/src/lib.rs | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'src-tauri/src/lib.rs') diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b5a5a5e9..a6254a99 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -505,28 +505,3 @@ pub fn convert_release_candidate_number(version_number: String) -> String { // Doesn't work for larger numbers, e.g. `v1.9.2-rc11` -> `v1.9.2011` (should be `v1.9.211`) version_number.replace("-rc", "0").replace("00", "") } - -/// Returns a serde json object of the parsed `enabledmods.json` file -pub fn get_enabled_mods(game_install: &GameInstall) -> Result { - let enabledmods_json_path = format!("{}/R2Northstar/enabledmods.json", game_install.game_path); - - // Check for JSON file - if !std::path::Path::new(&enabledmods_json_path).exists() { - return Err("enabledmods.json not found".to_string()); - } - - // Read file - let data = match std::fs::read_to_string(enabledmods_json_path) { - Ok(data) => data, - Err(err) => return Err(err.to_string()), - }; - - // Parse JSON - let res: serde_json::Value = match serde_json::from_str(&data) { - Ok(result) => result, - Err(err) => return Err(format!("Failed to read JSON due to: {}", err)), - }; - - // Return parsed data - Ok(res) -} -- cgit v1.2.3