Expand description
Various utilities for working with files and paths.
Structs§
Functions§
- ancestors
- Returns an iterator that walks up the directory hierarchy towards the root.
- append
- Equivalent to
write()
, but appends to the end instead of replacing the contents. - bytes2path
- Converts UTF-8 bytes to a path.
- copy
- Copies a file from one location to another.
- create
- Creates a new file.
- create_
dir_ all - Equivalent to
std::fs::create_dir_all
with better error messages. - create_
dir_ all_ excluded_ from_ backups_ atomic - Creates an excluded from cache directory atomically with its parents as needed.
- dylib_
path - Returns a list of directories that are searched for dynamic libraries.
- dylib_
path_ envvar - Returns the name of the environment variable used for searching for dynamic libraries.
- exclude_
from_ backups_ and_ indexing - Mark an existing directory as excluded from backups and indexing.
- join_
paths - Joins paths into a string suitable for the
PATH
environment variable. - link_
or_ copy - Hardlink (file) or symlink (dir) src to dst if possible, otherwise copy it.
- metadata
- Returns metadata for a file (follows symlinks).
- mtime
- Returns the last modification time of a file.
- mtime_
recursive - Returns the maximum mtime of the given path, recursing into subdirectories, and following symlinks.
- normalize_
path - Normalize a path, removing things like
.
and..
. - open
- Opens an existing file.
- path2bytes
- Converts a path to UTF-8 bytes.
- read
- Reads a file to a string.
- read_
bytes - Reads a file into a bytes vector.
- remove_
dir - Equivalent to
std::fs::remove_dir
with better error messages. - remove_
dir_ all - Equivalent to
std::fs::remove_dir_all
with better error messages. - remove_
file - Equivalent to
std::fs::remove_file
with better error messages. - resolve_
executable - Returns the absolute path of where the given executable is located based
on searching the
PATH
environment variable. - set_
file_ time_ no_ err - Changes the filesystem mtime (and atime if possible) for the given file.
- set_
invocation_ time - Record the current time on the filesystem (using the filesystem’s clock) using a file at the given directory. Returns the current time.
- strip_
prefix_ canonical - Strips
base
frompath
. - symlink_
metadata - Returns metadata for a file without following symlinks.
- write
- Writes a file to disk.
- write_
atomic - Writes a file to disk atomically.
- write_
if_ changed - Equivalent to
write()
, but does not write anything if the file contents are identical to the given contents.