Filesystem & processes

fs

File.Error - An error reading or writing a file.
Members: CouldNotOpen, WriteFailed, print

File.exists - Returns true if a file or directory exists at the path.

File.createDirectory - Creates a single directory, returning true on success.

File.removeDirectory - Removes an empty directory, returning true on success.

File.remove - Removes the file, returning true on success.

File.rename - Renames a file or directory, returning true on success.

File.currentDirectory - Returns the current working directory.

File.changeDirectory - Changes the current working directory, returning true on success.

File.read - Reads the entire file into a string, or returns an error if the file can't be opened.

File.write - Writes the string to the named file, returning null on success.

File.size - Returns the size of the file, or null if it can't be opened.

File.listDirectory - Returns the names in the directory, sorted, or an empty list if it can't be opened.

path

Path.isSeparator - Returns true for '/' and ''.

Path.splitDrive - Splits the drive/UNC prefix off the path.

Path.isAbsolute - Returns true for rooted paths: "/a", "C:/a", "C:", and UNC roots.

Path.isRelative - Returns true when the path is not absolute.

Path.split - Splits the path into (dir, base) at the last separator.

Path.dirname - Returns the directory half of Path.split(path).

Path.basename - Returns the file half of Path.split(path).

Path.splitExtension - Splits off the last extension; the extension keeps its dot, or is "".

Path.extension - Returns the extension with its dot, or "" when there is none.

Path.stem - Returns the basename without its last extension.

Path.stripExtension - Returns the path without its last extension.

Path.withExtension - Returns the path with its last extension replaced.

Path.hasExtension - Returns true when the path has an extension.

Path.isHidden - Returns true when the basename starts with '.'. The special names "." and ".." don't count.

Path.join - Joins two segments with '/'.

Path.joinAll - Folds Path.join over the parts.

Path.toPosixSeparators - Replaces '' with '/'.

Path.normalize - Collapses duplicate separators, resolves "." and ".." lexically, converts '' to '/', and drops the trailing slash.

Path.relativePath - Returns the lexical relative path from from to to.

Path.components - Splits the path into its non-empty parts.

process

Process.Result - The exit code and standard output of a finished subprocess.
Members: status, output

Process.getenv - Returns the value of the environment variable, or null if it's not set.

Process.setenv - Sets the environment variable, aborting on failure.

Process.run - Runs the command in a shell, returning its exit code and standard output.