Add a comment to canonicalize_path

This commit is contained in:
Wojciech Kępka 2021-06-06 07:34:18 +02:00 committed by Ivan Tham
parent de946d2357
commit bcb1afeb4c

View file

@ -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)))
} }