Provides an interface to the user's filesystem.

This module provides access to files in specific places:

*  The root folder of the .love archive (or source directory)
*  The root folder of the game's ''save directory''.
*  The folder ''containing'' the game's .love archive (or source directory), but only if [[love.filesystem.getSourceBaseDirectory|specific conditions]] are met.

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:

{| border="1" cellpadding="5" cellspacing="1" style="background-color:#E9F5FF; border: 1px solid #83C0F0;"
! OS
! Path
! Alternative
! Notes
|-
    |Windows XP
    |<code>C:\Documents and Settings\user\Application Data\LOVE\</code>
    |<code>%appdata%\LOVE\</code>
    |When fused, save directory will be created directly inside <code>Application Data</code>, rather than as a sub-directory of <code>LOVE</code>.
|-
    |Windows Vista, 7, 8 and 10
    |<code>C:\Users\user\AppData\Roaming\LOVE</code>
    |<code>%appdata%\LOVE\</code>
    |When fused, save directory will be created directly inside <code>AppData</code>, rather than as a sub-directory of <code>LOVE</code>.
|-
    |Mac
    |<code>/Users/user/Library/Application Support/LOVE/</code>
    | - 
    | -
|-
    |Linux
    |<code>$XDG_DATA_HOME/love/</code>
    |<code>~/.local/share/love/</code>
    | -
|-
    |Android
    |<code>/data/user/0/org.love2d.android/files/save/</code>
    |<code>/data/data/org.love2d.android/files/save/</code>
    |On Android there are various save locations. If these don't work then you can use <code>love.filesystem.getSaveDirectory()</code> to check.
|}

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 .love archive (in that order). So if a file with a certain filename (and path) exist in both the .love archive and the save folder, the one in the save directory takes precedence.

Note: '''All''' paths are relative to the .love archive and save directory. (except for the get*Directory() calls)

It is recommended to set your game's identity first in your [[Config Files|conf.lua]]. You can set it with [[love.filesystem.setIdentity]] as well.

{{notice|There's [https://bitbucket.org/MartinFelis/love-android-sdl2/issues/132 bug] in [[0.10.0]], up to [[0.10.2]] where any operation involving the game save directory (i.e. [[love.filesystem.write|writing]]) always fail in Android Marshmallow and later versions. The workaround is to enable [[Config_Files#externalstorage|externalstorage]] configuration.}}
== Types ==
{{#ask: [[Category:Types]] [[parent::love.filesystem]] [[Concept:Current]]
| headers=hide
| format=template
| template=ListingFields
| introtemplate=ListingIntro
| outrotemplate=ListingOutro
| ?Description
| ?PrettySince
| ?PrettyRemoved
| ?PrettyDeprecated
}}
== Functions ==
{{#ask: [[Category:Functions]] [[parent::love.filesystem]] [[Concept:Current]]
| headers=hide
| format=template
| template=ListingFields
| introtemplate=ListingIntro
| outrotemplate=ListingOutro
| ?Description
| ?PrettySince
| ?PrettyRemoved
| ?PrettyDeprecated
}}
== Enums ==
{{#ask: [[Category:Enums]] [[parent::love.filesystem]] [[Concept:Current]]
| headers=hide
| format=template
| template=ListingFields
| introtemplate=ListingIntro
| outrotemplate=ListingOutro
| ?Description
| ?PrettySince
| ?PrettyRemoved
}}
[[Category:Modules]]
{{#set:Description=Provides an interface to the user's filesystem.}}
== See Also ==
* [[parent::love]]
{{#set:Since=000}}
== Other Languages ==
{{i18n|love.filesystem}}