lovr.filesystem
EditThe lovr.filesystem
module provides access to the filesystem.
Functions
lovr.filesystem.append | Append content to the end of a file. |
lovr.filesystem.createDirectory | Create a directory. |
lovr.filesystem.getAppdataDirectory | Get the application data directory. |
lovr.filesystem.getDirectoryItems | Get a list of files in a directory. |
lovr.filesystem.getExecutablePath | Get the path of the LÖVR executable. |
lovr.filesystem.getIdentity | Get the name of the save directory. |
lovr.filesystem.getLastModified | Get the modification time of a file. |
lovr.filesystem.getRealDirectory | Get the absolute path to a file. |
lovr.filesystem.getRequirePath | Get the require path. |
lovr.filesystem.getSaveDirectory | Get the location of the save directory. |
lovr.filesystem.getSize | Get the size of a file. |
lovr.filesystem.getSource | Get the location of the project source. |
lovr.filesystem.getUserDirectory | Get the location of the user's home directory. |
lovr.filesystem.getWorkingDirectory | Get the current working directory. |
lovr.filesystem.isDirectory | Check whether a path is a directory. |
lovr.filesystem.isFile | Check whether a path is a file. |
lovr.filesystem.isFused | Check if the project is fused. |
lovr.filesystem.load | Load a file as Lua code. |
lovr.filesystem.mount | Mount a directory or archive. |
lovr.filesystem.newBlob | Create a new Blob from a file. |
lovr.filesystem.read | Read a file. |
lovr.filesystem.remove | Remove a file or directory. |
lovr.filesystem.setIdentity | Set the name of the save directory. |
lovr.filesystem.setRequirePath | Set the require path. |
lovr.filesystem.unmount | Unmount a mounted archive. |
lovr.filesystem.write | Write 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> |
Linux | /home/<user>/.local/share/LOVR/<identity> |
Android | /sdcard/Android/data/<identity>/files |
<identity>
should be a unique identifier for your app. It can be set either in lovr.conf
or by using lovr.filesystem.setIdentity
. On Android, the identity can not be changed and will always be the package id, like org.lovr.app
.
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.