|
|
@ -163,7 +163,7 @@ async fn load_or_create_control_file(control_path: impl AsRef<Path>) -> Result<M |
|
|
|
let mut dirty = false; |
|
|
|
let mut dirty = false; |
|
|
|
let mut control: MutableConfig = if control_path.is_file() { |
|
|
|
let mut control: MutableConfig = if control_path.is_file() { |
|
|
|
let f = tokio::fs::read(&control_path).await?; |
|
|
|
let f = tokio::fs::read(&control_path).await?; |
|
|
|
let mut control: MutableConfig = serde_json::from_slice(&f)?; |
|
|
|
let mut control: MutableConfig = json5::from_str(&String::from_utf8_lossy(&f))?; |
|
|
|
control._path = control_path.to_owned(); |
|
|
|
control._path = control_path.to_owned(); |
|
|
|
control |
|
|
|
control |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -185,7 +185,7 @@ async fn load_or_create_state_file(state_path: impl AsRef<Path>) -> Result<State |
|
|
|
let mut dirty = false; |
|
|
|
let mut dirty = false; |
|
|
|
let mut state: StateConfig = if state_path.is_file() { |
|
|
|
let mut state: StateConfig = if state_path.is_file() { |
|
|
|
let f = tokio::fs::read(&state_path).await?; |
|
|
|
let f = tokio::fs::read(&state_path).await?; |
|
|
|
let mut control: StateConfig = serde_json::from_slice(&f)?; |
|
|
|
let mut control: StateConfig = json5::from_str(&String::from_utf8_lossy(&f))?; |
|
|
|
control._path = state_path.to_owned(); |
|
|
|
control._path = state_path.to_owned(); |
|
|
|
control |
|
|
|
control |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -206,7 +206,7 @@ async fn load_locale_override_file(locale_path: impl AsRef<Path>) -> Result<Opti |
|
|
|
let locale_path = locale_path.as_ref(); |
|
|
|
let locale_path = locale_path.as_ref(); |
|
|
|
if locale_path.is_file() { |
|
|
|
if locale_path.is_file() { |
|
|
|
let f = tokio::fs::read(&locale_path).await?; |
|
|
|
let f = tokio::fs::read(&locale_path).await?; |
|
|
|
let opt : TranslationTable = serde_json::from_slice(&f)?; |
|
|
|
let opt : TranslationTable = json5::from_str(&String::from_utf8_lossy(&f))?; |
|
|
|
Ok(Some(opt)) |
|
|
|
Ok(Some(opt)) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Ok(None) |
|
|
|
Ok(None) |
|
|
@ -275,7 +275,7 @@ impl GroupConfig { |
|
|
|
let mut dirty = false; |
|
|
|
let mut dirty = false; |
|
|
|
let mut config: FixedConfig = if config_path.is_file() { |
|
|
|
let mut config: FixedConfig = if config_path.is_file() { |
|
|
|
let f = tokio::fs::read(&config_path).await?; |
|
|
|
let f = tokio::fs::read(&config_path).await?; |
|
|
|
let mut config: FixedConfig = serde_json::from_slice(&f)?; |
|
|
|
let mut config: FixedConfig = json5::from_str(&String::from_utf8_lossy(&f))?; |
|
|
|
config._path = config_path; |
|
|
|
config._path = config_path; |
|
|
|
if config.appdata != appdata { |
|
|
|
if config.appdata != appdata { |
|
|
|
config.appdata = appdata; |
|
|
|
config.appdata = appdata; |
|
|
@ -321,7 +321,7 @@ impl GroupConfig { |
|
|
|
|
|
|
|
|
|
|
|
/* config */ |
|
|
|
/* config */ |
|
|
|
let f = tokio::fs::read(&config_path).await?; |
|
|
|
let f = tokio::fs::read(&config_path).await?; |
|
|
|
let mut config: FixedConfig = serde_json::from_slice(&f)?; |
|
|
|
let mut config: FixedConfig = json5::from_str(&String::from_utf8_lossy(&f))?; |
|
|
|
config._path = config_path; |
|
|
|
config._path = config_path; |
|
|
|
|
|
|
|
|
|
|
|
/* control */ |
|
|
|
/* control */ |
|
|
|