2 releases
0.1.1 | Apr 19, 2022 |
---|---|
0.1.0 | Mar 24, 2022 |
#61 in #clean
Used in 2 crates
(via sftp-server)
8KB
245 lines
lexiclean-cow
Lexically clean rust paths.
See the docs for more information.
lib.rs
:
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:
-
Normally, if
file
is a file and not a directory, the pathfile/..
will fail to resolve to. Lexiclean resolves this to.
-
Path::canonicalize
returnsio::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/Some/absolute/directory
. -
Lexiclean does not respect symlinks.
Additional test cases and bug fixes are most welcome!
Dependencies
~31KB