aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-11-13 15:29:29 +0100
committerGitHub <noreply@github.com>2022-11-13 15:29:29 +0100
commitfa25001d7f2a1962de8990f077f7f1601679a292 (patch)
tree95116620a6bff140826154a2bd39a965f1955d03 /src-tauri/src
parent8393a08f4cb937805d41bb9a0f7901fb5221746e (diff)
downloadFlightCore-fa25001d7f2a1962de8990f077f7f1601679a292.tar.gz
FlightCore-fa25001d7f2a1962de8990f077f7f1601679a292.zip
feat: Add JSON5 support, allows comments in JSON (#50)
Some mods have comments in their JSON. Northstar handles it fine, so we should too.
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/mod_management/mod.rs4
1 files changed, 3 insertions, 1 deletions
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<String, anyhow::Error> {
// 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()) {