Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/paths/src/lib.rs')
-rw-r--r--crates/paths/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/paths/src/lib.rs b/crates/paths/src/lib.rs
index 6ae23ac841..ac09121aed 100644
--- a/crates/paths/src/lib.rs
+++ b/crates/paths/src/lib.rs
@@ -166,6 +166,11 @@ impl AbsPath {
AbsPathBuf::try_from(self.0.to_path_buf()).unwrap()
}
+ /// Equivalent of [`Path::canonicalize`] for `AbsPath`.
+ pub fn canonicalize(&self) -> Result<AbsPathBuf, std::io::Error> {
+ Ok(self.as_ref().canonicalize()?.try_into().unwrap())
+ }
+
/// Equivalent of [`Path::strip_prefix`] for `AbsPath`.
///
/// Returns a relative path.