lovr.filesystem

The lovr.filesystem module provides access to the filesystem.

Functions

lovr.filesystem.appendAppend content to the end of a file.
lovr.filesystem.createDirectoryCreate a directory.
lovr.filesystem.getAppdataDirectoryGet the application data directory.
lovr.filesystem.getApplicationIdGet the application ID.
lovr.filesystem.getDirectoryItemsGet a list of files in a directory.
lovr.filesystem.getExecutablePathGet the path of the LÖVR executable.
lovr.filesystem.getIdentityGet the name of the save directory.
lovr.filesystem.getLastModifiedGet the modification time of a file.
lovr.filesystem.getRealDirectoryGet the absolute path to a file.
lovr.filesystem.getRequirePathGet the require path.
lovr.filesystem.getSaveDirectoryGet the location of the save directory.
lovr.filesystem.getSizeGet the size of a file.
lovr.filesystem.getSourceGet the location of the project source.
lovr.filesystem.getUserDirectoryGet the location of the user's home directory.
lovr.filesystem.getWorkingDirectoryGet the current working directory.
lovr.filesystem.isDirectoryCheck whether a path is a directory.
lovr.filesystem.isFileCheck whether a path is a file.
lovr.filesystem.isFusedCheck if the project is fused.
lovr.filesystem.loadLoad a file as Lua code.
lovr.filesystem.mountMount a directory or archive.
lovr.filesystem.newBlobCreate a new Blob from a file.
lovr.filesystem.readRead a file.
lovr.filesystem.removeRemove a file or directory.
lovr.filesystem.setIdentitySet the name of the save directory.
lovr.filesystem.setRequirePathSet the require path.
lovr.filesystem.setSourceSet the project source.
lovr.filesystem.unmountUnmount a mounted archive.
lovr.filesystem.writeWrite to a file.

Notes

LÖVR programs can only write to a single directory, called the save directory. The location of the save directory is platform-specific:

Windows C:\Users\<user>\AppData\Roaming\LOVR\<identity>
macOS /Users/<user>/Library/Application Support/LOVR/<identity>

<identity> should be a unique identifier for your app. It can be set either in lovr.conf or by using lovr.filesystem.setIdentity.

All filenames are relative to either the save directory or the directory containing the project source. Files in the save directory take precedence over files in the project.