From bcb1afeb4ca9d1764b2f1dba08f9772ac744c83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20K=C4=99pka?= Date: Sun, 6 Jun 2021 07:34:18 +0200 Subject: [PATCH] Add a comment to `canonicalize_path` --- helix-view/src/document.rs | 4 ++++ 1 file changed, 4 insertions(+) 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 { std::env::current_dir().map(|current_dir| normalize_path(¤t_dir.join(path))) }