Skip to content
JoeStrout edited this page Sep 11, 2026 · 2 revisions

file module

Name Parameters Purpose
curdir Get current working directory
setdir path Change current working directory
children path Get list of file and directory names in the given directory
name path Get the filename (last path component) of a path string
exists path Get whether a file or directory exists at the given path
info path Get a map of info (path, isDirectory, size, date) about the given path
makedir path Create a directory at the given path
parent path Get the parent directory of the given path
child parentPath, childName Combine a parent path and child name into a single path
move oldPath, newPath Move (rename) a file or directory
copy oldPath, newPath Copy a file
delete path Delete a file or empty directory
open path, mode="r+" Open a file; returns a FileHandle, or null on failure
readLines path Read all lines from a text file, returning a list of strings
writeLines path, lines Write a list of strings (or a single string) to a text file
loadRaw path Load a binary file, returning a RawData object
saveRaw path, data Save a RawData object to a binary file
enterSandbox Enter sandbox mode (one-way; there is no way back)
mountAppData mountName="usr", folderName Mount a folder of this application's own data as /usr or /usr2
unmount mountName="usr" Unmount /usr or /usr2
droppedFiles Files the user has dropped on the window: [{name, isDirectory}]
dropPosition Where in the window the last drop landed: {x, y}
mountDropped index=0, mountName="usr" Mount one of those dropped files as /usr or /usr2
clearDroppedFiles Forget the dropped files (the next drop clears them anyway)

Once enterSandbox has been called, paths are virtual: they are always /-separated, name one of the mounted disks, and reach nothing else. Before that, they are ordinary host paths.

Clone this wiki locally