diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2022-11-02 17:44:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 17:44:00 +0100 |
commit | d2ab94e7e0e786b35d54a855926a0c3be0737b0f (patch) | |
tree | 08901ae868b7a5460b01daf704db21ddc26e0042 /src-tauri/src/lib.rs | |
parent | 566ac39852359cd7e2ab228a2994ef8ce2b13ae2 (diff) | |
download | FlightCore-d2ab94e7e0e786b35d54a855926a0c3be0737b0f.tar.gz FlightCore-d2ab94e7e0e786b35d54a855926a0c3be0737b0f.zip |
refactor: Use existing function for enabled mods (#34)
Instead of re-implementing existing logic just re-use what we already
have.
Diffstat (limited to 'src-tauri/src/lib.rs')
-rw-r--r-- | src-tauri/src/lib.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 84920727..cfc5fb57 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -482,17 +482,8 @@ pub fn set_mod_enabled_status( /// - name /// - is enabled? pub fn get_installed_mods(game_install: GameInstall) -> Result<Vec<NorthstarMod>, String> { - let enabled_mods_json_path = format!("{}/R2Northstar/enabledmods.json", game_install.game_path); - // Open file - let data = match std::fs::read_to_string(enabled_mods_json_path) { - Ok(data) => data, - Err(err) => return Err(err.to_string()), - }; - // Check if valid JSON and parse - let res: serde_json::Value = match serde_json::from_str(&data) { - Ok(res) => res, - Err(err) => return Err(err.to_string()), - }; + // Get enabled mods as JSON + let res: serde_json::Value = get_enabled_mods(game_install)?; let mut installed_mods = Vec::new(); |