Pyro

A scripting language for people who enjoy the simpler things in life.

Version 0.5.37

$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 if path exists. If path is a symlink, returns true if the target of the link exists.

is_dir(path: str) -> bool

Returns true if path exists and is a directory. If path is a symlink, returns true if the target of the link exists and is a directory.

is_file(path: str) -> bool

Returns true if path exists and is a regular file. If path is a symlink, returns true if the target of the link exists and is a regular file.

is_symlink(path: str) -> bool

Returns true if path 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 POSIX realpath().

rm(path: str)

Deletes the symlink, file, or directory at path. If path is a symlink, the link itself will be deleted, not its target. If path is a directory, the directory and all its content will be deleted.