$std::path
This module contains filepath utilities.
Functions
-
basename(path: str) -> str
-
Extracts the base part of a pathname. Equivalent to POSIX
basename()
. -
cd(path: str)
-
Changes the current working directory to
path
. -
cwd() -> str
-
Returns the directory path of the current working directory.
-
dirname(path: str) -> str
-
Extracts the directory part of a pathname. Equivalent to POSIX
dirname()
. -
exists(path: str) -> bool
-
Returns
true
ifpath
exists. Ifpath
is a symlink, returnstrue
if the target of the link exists. -
is_dir(path: str) -> bool
-
Returns
true
ifpath
exists and is a directory. Ifpath
is a symlink, returnstrue
if the target of the link exists and is a directory. -
is_file(path: str) -> bool
-
Returns
true
ifpath
exists and is a regular file. Ifpath
is a symlink, returnstrue
if the target of the link exists and is a regular file. -
is_symlink(path: str) -> bool
-
Returns
true
ifpath
exists and is a symlink. (This checks if the symlink itself exists, not its target.) -
join(arg1: str, arg2: str, ...) -> str
-
Joins path components, adding a separating
/
if required. -
listdir(path: str) -> vec[str]
-
Returns a vector containing the names of the entries in the directory specified by
path
. Skips"."
and".."
. -
realpath(path: str) -> str
-
Returns the canonicalized absolute path, resolving all symbolic links. All the components of
path
must exist. Equivalent to POSIXrealpath()
. -
rm(path: str)
-
Deletes the symlink, file, or directory at
path
. Ifpath
is a symlink, the link itself will be deleted, not its target. Ifpath
is a directory, the directory and all its content will be deleted.