From fa25001d7f2a1962de8990f077f7f1601679a292 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 13 Nov 2022 15:29:29 +0100 Subject: feat: Add JSON5 support, allows comments in JSON (#50) Some mods have comments in their JSON. Northstar handles it fine, so we should too. --- src-tauri/src/mod_management/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src-tauri/src') diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index e3034903..ecfd3835 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -7,6 +7,8 @@ use std::path::PathBuf; use app::GameInstall; use app::get_enabled_mods; +use json5; + /// Set the status of a passed mod to enabled/disabled pub fn set_mod_enabled_status( game_install: GameInstall, @@ -42,7 +44,7 @@ pub fn set_mod_enabled_status( fn parse_mod_json_for_mod_name(mod_json_path: String) -> Result { // Read file into string and parse it let data = std::fs::read_to_string(mod_json_path)?; - let parsed_json: serde_json::Value = serde_json::from_str(&data)?; + let parsed_json: serde_json::Value = json5::from_str(&data)?; // Extract mod name let mod_name = match parsed_json.get("Name").and_then(|value| value.as_str()) { -- cgit v1.2.3