aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Kępka2021-06-06 05:34:18 +0000
committerIvan Tham2021-06-06 09:28:09 +0000
commitbcb1afeb4ca9d1764b2f1dba08f9772ac744c83a (patch)
treeee6558e36dc04ed31a05025fd857fa4b593e5dd3
parentde946d2357e2cd4b64acbfc7bb45e3ead3785b83 (diff)
Add a comment to `canonicalize_path`
-rw-r--r--helix-view/src/document.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index f901e644..9093dbe8 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -104,6 +104,10 @@ pub fn normalize_path(path: &Path) -> PathBuf {
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> {
std::env::current_dir().map(|current_dir| normalize_path(&current_dir.join(path)))
}