Module uucore::fs

source ·
Expand description

Set of functions to manage files and symlinks

Macros

  • Used to check if the mode has its perm bit set.

Structs

Enums

  • Controls how symbolic links should be handled when canonicalizing a path.
  • Controls when symbolic links are resolved

Functions

  • 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
  • Checks if two paths are hard links to the same file.
  • Return the canonical, absolute form of a path.
  • For some programs like install or mkdir, dir/. can be provided Special case to match GNU’s behavior: install -d foo/. should work and just create foo/ std::fs::create_dir(“foo/.”); fails in pure Rust
  • Display the permissions of a file On non unix like system, just show ‘–––––’
  • Display the permissions of a file on a unix like system
  • Checks if p1 and p2 are the same file information. If error happens when trying to get files’ metadata, returns false
  • Checks if there is a symlink loop in the given path.
  • Converts absolute path to be relative to absolute to 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
  • Checks if p1 and p2 are the same file. If error happens when trying to get files’ metadata, returns false
  • resolve a relative path