Add AbsPath::absolutize

This commit is contained in:
Lukas Wirth 2023-05-13 11:51:28 +02:00
parent 939ebb4454
commit f47caa666e
2 changed files with 13 additions and 7 deletions

View file

@ -140,6 +140,11 @@ impl AbsPath {
self.0.parent().map(AbsPath::assert)
}
/// Equivalent of [`Path::join`] for `AbsPath` with an additional normalize step afterwards.
pub fn absolutize(&self, path: impl AsRef<Path>) -> AbsPathBuf {
self.join(path).normalize()
}
/// Equivalent of [`Path::join`] for `AbsPath`.
pub fn join(&self, path: impl AsRef<Path>) -> AbsPathBuf {
self.as_ref().join(path).try_into().unwrap()