From 9f8bca26d5336762bb75fb89c6552a7a83c9b2d8 Mon Sep 17 00:00:00 2001 From: Jeremy Whiting Date: Wed, 25 Jun 2025 09:42:35 -0600 Subject: [PATCH] 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. --- src/platform.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform.rs b/src/platform.rs index cc4f897..975f353 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -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> { - 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())?)) }