fix(config): resolve config paths absolutely to ensure correct source_dir
This commit is contained in:
parent
7346c11a6e
commit
c463ea423c
1 changed files with 3 additions and 2 deletions
|
|
@ -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)?);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue