on master help sign in
Add a comment to `canonicalize_path`
commitbcb1afeb4ca9d1764b2f1dba08f9772ac744c83a authorWojciech Kępka <wojtek.kepka@protonmail.com> dateSun 6 Jun 2021, 07:34 (5 years ago) parentde946d2
1 file changed+4
helix-view/src/document.rs+4
helix-view/src/document.rs+4
@@ -104,6 +104,10 @@ pub fn normalize_path(path: &Path) -> PathBuf {
104104 ret
105105}
106106
107+// Returns the canonical, absolute form of a path with all intermediate components normalized.
108+//
109+// This function is used instead of `std::fs::canonicalize` because we don't want to verify
110+// here if the path exists, just normalize it's components.
107111pub fn canonicalize_path(path: &Path) -> std::io::Result<PathBuf> {
108112 std::env::current_dir().map(|current_dir| normalize_path(&current_dir.join(path)))
109113}