Module paths

Source
Expand description

Various utilities for working with files and paths.

Structs§

PathAncestors

Functions§

_create_dir_all 🔒
_link_or_copy 🔒
_remove_dir 🔒
_remove_dir_all 🔒
_remove_file 🔒
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 🔒
Marks the directory as excluded from archives/backups.
exclude_from_backups_and_indexing
Mark an existing directory as excluded from backups and indexing.
exclude_from_content_indexing 🔒
Marks the directory as excluded from content indexing.
exclude_from_time_machine 🔒
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.
remove_file_with_permission_check 🔒
remove_with_permission_check 🔒
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.
set_not_readonly 🔒
strip_prefix_canonical
Strips base from path.
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.