Add some context of which file is missing.

In one case where platform.toml is not where we expect add to the
os error 2 which file we were looking for.
This commit is contained in:
Jeremy Whiting 2025-06-25 09:42:35 -06:00 committed by Jeremy Whiting
parent 7d350bd585
commit 9f8bca26d5

View file

@ -5,6 +5,8 @@
* SPDX-License-Identifier: MIT
*/
#[cfg(not(test))]
use anyhow::Context;
use anyhow::Result;
use nix::errno::Errno;
use nix::unistd::{access, AccessFlags};
@ -173,7 +175,10 @@ impl FormatDeviceConfig {
impl PlatformConfig {
#[cfg(not(test))]
async fn load() -> Result<Option<PlatformConfig>> {
let config = read_to_string("/usr/share/steamos-manager/platform.toml").await?;
let path = "/usr/share/steamos-manager/platform.toml";
let config = read_to_string(path)
.await
.with_context(|| format!("Failed to read {path}"))?;
Ok(Some(toml::from_str(config.as_ref())?))
}