mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-17 11:46:46 -04:00
Also add context when unable to read orca config file.
This commit is contained in:
parent
9f8bca26d5
commit
779d468e05
1 changed files with 13 additions and 5 deletions
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use ::sysinfo::System;
|
use ::sysinfo::System;
|
||||||
use anyhow::{anyhow, bail, ensure, Result};
|
use anyhow::{anyhow, bail, ensure, Context, Result};
|
||||||
use gio::{prelude::SettingsExt, Settings};
|
use gio::{prelude::SettingsExt, Settings};
|
||||||
use input_linux::Key;
|
use input_linux::Key;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
@ -327,7 +327,10 @@ impl<'dbus> OrcaManager<'dbus> {
|
||||||
|
|
||||||
async fn set_orca_enabled(&mut self, enabled: bool) -> Result<()> {
|
async fn set_orca_enabled(&mut self, enabled: bool) -> Result<()> {
|
||||||
// Change json file
|
// Change json file
|
||||||
let data = read_to_string(self.settings_path()?).await?;
|
let path = self.settings_path()?;
|
||||||
|
let data = read_to_string(&path)
|
||||||
|
.await
|
||||||
|
.with_context(|| format!("Unable to read from {}", path.display()))?;
|
||||||
let mut json: Value = serde_json::from_str(&data)?;
|
let mut json: Value = serde_json::from_str(&data)?;
|
||||||
|
|
||||||
let general = json
|
let general = json
|
||||||
|
@ -345,8 +348,10 @@ impl<'dbus> OrcaManager<'dbus> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn load_values(&mut self) -> Result<()> {
|
async fn load_values(&mut self) -> Result<()> {
|
||||||
debug!("Loading orca values from user-settings.conf");
|
let path = self.settings_path()?;
|
||||||
let data = read_to_string(self.settings_path()?).await?;
|
let data = read_to_string(&path)
|
||||||
|
.await
|
||||||
|
.with_context(|| format!("Unable to read from {}", path.display()))?;
|
||||||
let json: Value = serde_json::from_str(&data)?;
|
let json: Value = serde_json::from_str(&data)?;
|
||||||
|
|
||||||
let Some(default_voice) = json
|
let Some(default_voice) = json
|
||||||
|
@ -405,7 +410,10 @@ impl<'dbus> OrcaManager<'dbus> {
|
||||||
} else {
|
} else {
|
||||||
bail!("Invalid orca option {option}");
|
bail!("Invalid orca option {option}");
|
||||||
}
|
}
|
||||||
let data = read_to_string(self.settings_path()?).await?;
|
let path = self.settings_path()?;
|
||||||
|
let data = read_to_string(&path)
|
||||||
|
.await
|
||||||
|
.with_context(|| format!("Unable to read from {}", path.display()))?;
|
||||||
let mut json: Value = serde_json::from_str(&data)?;
|
let mut json: Value = serde_json::from_str(&data)?;
|
||||||
|
|
||||||
let profiles = json
|
let profiles = json
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue