Add a comment to canonicalize_path
This commit is contained in:
parent
de946d2357
commit
bcb1afeb4c
1 changed files with 4 additions and 0 deletions
|
@ -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(¤t_dir.join(path)))
|
std::env::current_dir().map(|current_dir| normalize_path(¤t_dir.join(path)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue