fix(config): resolve config paths absolutely to ensure correct source_dir

This commit is contained in:
Ray Andrew 2026-02-17 15:12:59 -06:00
parent 7346c11a6e
commit c463ea423c
Signed by: rayandrew
SSH key fingerprint: SHA256:EUCV+qCSqkap8rR+p+zGjxHfKI06G0GJKgo1DIOniQY

View file

@ -26,11 +26,12 @@ use std::collections::HashMap;
use std::path::PathBuf;
/// Resolves the config file path, checking the given path or default locations.
/// Always returns an absolute path so source_dir is correct regardless of CWD.
#[tracing::instrument(skip_all)]
pub fn find_config_file(base: Option<PathBuf>) -> anyhow::Result<PathBuf> {
if let Some(path) = base {
if path.exists() {
return Ok(path);
return Ok(std::fs::canonicalize(&path)?);
}
anyhow::bail!("config file not found: {}", path.display());
}
@ -39,7 +40,7 @@ pub fn find_config_file(base: Option<PathBuf>) -> anyhow::Result<PathBuf> {
for candidate in candidates {
if candidate.exists() {
return Ok(candidate);
return Ok(std::fs::canonicalize(&candidate)?);
}
}