path_dedot/
parse_dot.rs

1use std::{borrow::Cow, io, path::Path};
2
3/// Let `Path` and `PathBuf` have `parse_dot` method.
4pub trait ParseDot {
5    /// Remove dots in the path and create a new `PathBuf` instance on demand.
6    fn parse_dot(&self) -> io::Result<Cow<Path>>;
7
8    /// Remove dots in the path and create a new `PathBuf` instance on demand. It gets the current working directory as the second argument.
9    fn parse_dot_from(&self, cwd: impl AsRef<Path>) -> io::Result<Cow<Path>>;
10}