From 82c32e8622eac99e1a926d477605a3a9a887ccdc Mon Sep 17 00:00:00 2001 From: Leonardo Forchini Date: Wed, 21 Oct 2026 09:30:41 +0100 Subject: [PATCH] Don't apply custom Path prefix twice In some instances, a prefix could be appended twice. Some config loading functions would take a `util::Path` (prefixed), convert it to a `std::*::Path` (still prefixed), and then convert it to a `util::Path` again, doubling the prefix. Don't perform this intermediate step, directly append to the `util::Path`. Signed-off-by: Leonardo Forchini --- src/backends/qemu/mod.rs | 2 +- src/engines/threshold.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/qemu/mod.rs b/src/backends/qemu/mod.rs index 13f3ba9a..6d9f73e9 100644 --- a/src/backends/qemu/mod.rs +++ b/src/backends/qemu/mod.rs @@ -82,7 +82,7 @@ impl QemuConfig { /// Read `/qemu.json` if present, otherwise return the /// built-in defaults. pub fn from_dir(dir: &Path) -> Result { - let path = Path::new(&dir.join("qemu.json")); + let path = dir.join("qemu.json"); config::load_config_or_default(&path) } } diff --git a/src/engines/threshold.rs b/src/engines/threshold.rs index dc5a51ad..8b0f9c7e 100644 --- a/src/engines/threshold.rs +++ b/src/engines/threshold.rs @@ -408,7 +408,7 @@ impl ThresholdEngine { /// Load `threshold.json`, falling back to built-in defaults when absent. pub fn from_config_dir(dir: &Path) -> Result { - let path = Path::new(&dir.join(format!("{ENGINE_NAME}.json"))); + let path = dir.join(format!("{ENGINE_NAME}.json")); let cfg: ThresholdConfig = config::load_config_or_default(&path)?; cfg.validate()?; Ok(Self::new(cfg))