Filesystem & processes
fs
exists - Returns true
if a file or directory exists at the path.
createDirectory -
Creates a single directory, returning true on success.
removeDirectory -
Removes an empty directory, returning true on success.
remove - Removes the
file, returning true on success.
rename - Renames a file
or directory, returning true on success.
currentDirectory -
Returns the current working directory.
changeDirectory -
Changes the current working directory, returning true on success.
fileSize - Returns
the size of the file, or null if it can't be opened.
listDirectory -
Returns the names in the directory, sorted, or an empty list if it can't
be opened.
path
isSeparator -
Returns true for '/' and ''.
splitDrive -
Splits the drive/UNC prefix off the path.
isAbsolute -
Returns true for rooted paths: "/a", "C:/a", "C:", and UNC roots.
isRelative -
Returns true when the path is not absolute.
split - Splits the
path into (dir, base) at the last separator.
dirname - Returns
the directory half of split(path).
basename - Returns
the file half of split(path).
splitExtension -
Splits off the last extension; the extension keeps its dot, or is
"".
extension -
Returns the extension with its dot, or "" when there is none.
stem - Returns the
basename without its last extension.
stripExtension -
Returns the path without its last extension.
withExtension
- Returns the path with its last extension replaced.
hasExtension -
Returns true when the path has an extension.
isHidden - Returns
true when the basename starts with '.'. The special names "." and ".."
don't count.
join - Joins two
segments with '/'.
joinAll - Folds join
over the parts.
toPosixSeparators
- Replaces '' with '/'.
normalize -
Collapses duplicate separators, resolves "." and ".." lexically,
converts '' to '/', and drops the trailing slash.
relativePath -
Returns the lexical relative path from from to
to.
components -
Splits the path into its non-empty parts.
process
ProcessResult -
The exit code and standard output of a finished subprocess.
Members: status, output
getenv - Returns
the value of the environment variable, or null if it's not set.
setenv - Sets the
environment variable, aborting on failure.
run - Runs the
command in a shell, returning its exit code and standard output.