This crate exports a single trait,
Lexiclean, with a single method,
lexiclean, implemented on
&Path, that performs lexical path cleaning.
Lexical path cleaning simplifies paths without looking at the underlying filesystem. This means:
fileis a file and not a directory, the path
file/..will fail to resolve to. Lexiclean resolves this to
io::Result<PathBuf>, because it must make system calls, that might fail. Lexiclean does not make system calls, and thus cannot fail.
The path returned by lexiclean will only contain components present in the input path. This can make the resultant paths more legible for users, since
foo/..will resolve to
., and not
Lexiclean does not respect symlinks.
Lexiclean has only been lightly tested. In particular, it has not been tested with windows paths, which are very complicated, and can contain many types of components that the author of this crate never contemplated.
Additional test cases and bug fixes are most welcome!