Module paths

Source
Expand description

Upstream: https://github.com/rust-lang/cargo/blob/rust-1.83.0/crates/cargo-util/src/paths.rs Various utilities for working with files and paths.

Structs§

PathAncestors
An iterator that walks up the directory hierarchy towards the root.

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).
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.
strip_prefix_canonical
Strips base from path.
symlink_metadata
Returns metadata for a file without following symlinks.
temp_dir_in
Creates a temporary directory in the given path and calls the given function.
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.