pub fn resolve_under(base: &Path, path: &Path) -> PathBufExpand description
Resolve a possibly-relative path against base, returning a lexically
normalized PathBuf.
Behavior:
- Absolute
pathpasses through unchanged (only normalized). - Relative
pathis joined ontobase. .and..components are collapsed lexically — purely by string manipulation, without touching the filesystem and without requiring the path (or its parents) to exist.
Lexical (rather than std::fs::canonicalize) resolution is the deliberate
choice for tool path handling: write/patch tools must resolve targets that
do not yet exist on disk, and canonicalization both fails for missing paths
and silently rewrites symlinks. Tools that genuinely need symlink-real-path
resolution for an existence/scope check should use canonicalize_under
instead and accept that it requires the path to exist.