Expand description
Set of functions to manage regular files, special files, and links.
Modules§
Macros§
- has
- Used to check if the
modehas itspermbit set.
Structs§
- File
Information - Information to uniquely identify a file
Enums§
- Missing
Handling - Controls how symbolic links should be handled when canonicalizing a path.
- Resolve
Mode - Controls when symbolic links are resolved
Functions§
- are_
hardlinks_ or_ one_ way_ symlink_ to_ same_ file - Checks if either two paths are hard links to the same file or if the source path is a symbolic link which when fully resolved points to target path
- are_
hardlinks_ to_ same_ file - Checks if two paths are hard links to the same file.
- canonicalize
- Return the canonical, absolute form of a path.
- dir_
strip_ dot_ for_ creation - For some programs like install or mkdir, dir/. or dir/./ can be provided Special case to match GNU’s behavior: install -d foo/. (and foo/./) should work and just create foo/ std::fs::create_dir(“foo/.”); fails in pure Rust
- display_
permissions - Display the permissions of a file
- display_
permissions_ unix - Display the permissions of a file on a unix like system
- get_
filename - Extracts the filename component from the given
filepath and returns it as anOption<&str>. - infos_
refer_ to_ same_ file - Checks if
p1andp2are the same file information. If error happens when trying to get files’ metadata, returns false - is_
stdin_ directory - Checks if the standard input (stdin) is a directory.
- is_
symlink_ loop - Checks if there is a symlink loop in the given path.
- make_
fifo - Make a FIFO, also known as a named pipe.
- make_
path_ relative_ to - Converts absolute
pathto be relative to absolutetopath. - normalize_
path - Normalize a path by removing relative information
For example, convert ‘bar/../foo/bar.txt’ => ‘foo/bar.txt’
copied from
<https://github.com/rust-lang/cargo/blob/2e4cfc2b7d43328b207879228a2ca7d427d188bb/src/cargo/util/paths.rs#L65-L90>both projects are MIT<https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT>for std impl progress see rfc<https://github.com/rust-lang/rfcs/issues/2208>replace this once that lands - path_
ends_ with_ terminator - Returns true if the passed
pathends with a path terminator. - paths_
refer_ to_ same_ file - Checks if
p1andp2are the same file. If error happens when trying to get files’ metadata, returns false