Add a comment to `canonicalize_path`

imgbot
Wojciech Kępka 4 years ago committed by Ivan Tham
parent de946d2357
commit bcb1afeb4c

@ -104,6 +104,10 @@ pub fn normalize_path(path: &Path) -> PathBuf {
ret ret
} }
// Returns the canonical, absolute form of a path with all intermediate components normalized.
//
// This function is used instead of `std::fs::canonicalize` because we don't want to verify
// here if the path exists, just normalize it's components.
pub fn canonicalize_path(path: &Path) -> std::io::Result<PathBuf> { pub fn canonicalize_path(path: &Path) -> std::io::Result<PathBuf> {
std::env::current_dir().map(|current_dir| normalize_path(&current_dir.join(path))) std::env::current_dir().map(|current_dir| normalize_path(&current_dir.join(path)))
} }

Loading…
Cancel
Save