love.filesystem
Provides an interface to the user's filesystem.
This module provides access to Files in two places, and two places only:
- The root folder of the .love-file. (Alternatively a directory).
- The root folder of the write directory.
Each game is granted a single directory on the system where files can be saved through love.filesystem. This is the only directory where love.filesystem can write files. These directories will typically be found in something like:
- Windows XP:
C:\Documents and Settings\user\Application Data\Love\
or%appdata%\Love\
- Windows Vista and 7:
C:\Users\user\AppData\Roaming\LOVE
or%appdata%\Love\
- Linux:
$XDG_DATA_HOME/love/
or~/.local/share/love/
- mac:
/Library/Application Support/LOVE/
Files that are opened for write or append will always be created in the save directory. The same goes for other operations that involve writing to the filesystem, like mkdir.
Files that are opened for read will be looked for in the save directory, and then in the game root folder (in that order). So if a file with a certain filename (and path) exist in both the .love-file and the save folder, the one in the save directory takes precedence.
Note: All paths are relative to the .love and save directory. (except for the get*Directory() calls)
It is recommended to set your game's identity first in your conf.lua
. You can set it with love.filesystem.setIdentity()
as well.
Contents
Types
DroppedFile | Represents a file dropped from the window. |
Functions
love.filesystem.append | Append data to an existing file. |
love.filesystem.areSymlinksEnabled | Gets whether love.filesystem follows symbolic links. |
love.filesystem.createDirectory | Creates a directory. |
love.filesystem.getCRequirePath | Gets the filesystem paths that will be searched for c libraries when require is called. |
love.filesystem.getDirectoryItems | Returns all the files and subdirectories in the directory. |
love.filesystem.getIdentity | Gets the write directory name for your game. |
love.filesystem.getInfo | Gets information about the specified file or directory. |
love.filesystem.getLastModified | Gets the last modification time of a file. |
love.filesystem.getRealDirectory | Gets the absolute path of the directory containing a filepath. |
love.filesystem.getRequirePath | Gets the filesystem paths that will be searched when require is called. |
love.filesystem.getSize | Gets the size in bytes of a file. |
love.filesystem.getSource | Returns the full path to the .love file or directory. |
love.filesystem.getSourceBaseDirectory | Returns the full path to the directory containing the .love file. |
love.filesystem.isFused | Gets whether the game is in fused mode or not. |
love.filesystem.isSymlink | Gets whether a filepath is actually a symbolic link. |
love.filesystem.load | Loads a Lua file (but does not run it). |
love.filesystem.mount | Mounts a zip file or folder in the game's save directory for reading. |
love.filesystem.mountFullPath | Mounts a full platform-dependent path to a zip file or folder for reading or writing in love.filesystem. |
love.filesystem.openFile | Opens a new File object, which represents an existing or new file on disk. |
love.filesystem.setCRequirePath | Sets the filesystem paths that will be searched for c libraries when require is called. |
love.filesystem.setIdentity | Sets the write directory for your game. |
love.filesystem.setRequirePath | Sets the filesystem paths that will be searched when require is called. |
love.filesystem.setSymlinksEnabled | Sets whether love.filesystem follows symbolic links. |
love.filesystem.unmount | Unmounts a zip file or folder previously mounted with love.filesystem.mount. |
love.filesystem.unmountFullPath | Unmounts a zip file or folder previously mounted with love.filesystem.mountFullPath. |
Enums
FileType | The type of a file. |
LoadMode | Possible load modes for love.filesystem.load. |
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info