pub fn resolve_path(path: &Path) -> Result<PathBuf>
Resolve a path to its canonical form, handling non-existent files by canonicalizing the nearest existing ancestor and joining the rest.