fs

Note: parts of this file are platform-conditional (#if).

Functions: exists, createDirectory, removeDirectory, remove, rename, currentDirectory, changeDirectory, fileSize, listDirectory

exists

bool exists(string path)

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

createDirectory

bool createDirectory(string path)

Creates a single directory, returning true on success.

removeDirectory

bool removeDirectory(string path)

Removes an empty directory, returning true on success.

remove

bool remove(string path)

Removes the file, returning true on success.

rename

bool rename(string oldPath, string newPath)

Renames a file or directory, returning true on success.

currentDirectory

StringBuf currentDirectory()

Returns the current working directory.

changeDirectory

bool changeDirectory(string path)

Changes the current working directory, returning true on success.

fileSize

int64? fileSize(string path)

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

listDirectory

List<StringBuf> listDirectory(string path)

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

Names come from the shell, so a name containing a line break is split in two.