diff --git a/crates/doot-cli/src/commands/mod.rs b/crates/doot-cli/src/commands/mod.rs index 1d72639..e18cd4c 100644 --- a/crates/doot-cli/src/commands/mod.rs +++ b/crates/doot-cli/src/commands/mod.rs @@ -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) -> anyhow::Result { 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) -> anyhow::Result { for candidate in candidates { if candidate.exists() { - return Ok(candidate); + return Ok(std::fs::canonicalize(&candidate)?); } }