Module path

Source
Expand description

Path-related utilities.

Functions§

absolute
Return the absolute and normalized path without accessing the filesystem.
atomic_write_symlink
Pick a random file name path.$RAND.atomic as real_path. Write data to it. Then modify the symlink path to point to real_path. Attempt to delete files that are no longer referred.
create_dir
Create the directory and ignore failures when a directory of the same name already exists.
create_dir_all_with_mode
Create the directory and its ancestors. The mode argument is ignored on non-UNIX systems.
create_shared_dir
Create the directory with group write permission on UNIX systems.
create_shared_dir_all
Create the directory and ancestors with group write permission on UNIX systems.
expand_path
Expand the user’s home directory and any environment variables references in the given path.
normalize
Normalize path to collapse “..”, “.”, and duplicate separators. This function does not access the filesystem, so it can return an incorrect result if the path contains symlinks.
relativize
Return a relative PathBuf to the path from the base path.
remove_file
Remove the file pointed by path.
root_relative_path
Given cwd, return path relative to root, or None if path is not under root. This is analagous to pathutil.canonpath() in Python.
strip_unc_prefix
Removes the UNC prefix \\?\ on Windows. Does nothing on unices.
symlink_dir
Create symlink for a dir.
symlink_file
Create symlink for a file.