Difference between revisions of "love.filesystem.mount"
Schmirsich (talk | contribs) m (Add note that the source base directory can be mounted in fused mode) |
(added examples were in the wrong section and don't always work) |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 2: | Line 2: | ||
Mounts a zip file or folder in the game's save directory for reading. | Mounts a zip file or folder in the game's save directory for reading. | ||
It is also possible to mount [[love.filesystem.getSourceBaseDirectory]] if the game is in fused mode. | It is also possible to mount [[love.filesystem.getSourceBaseDirectory]] if the game is in fused mode. | ||
+ | |||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | success = love.filesystem.mount( archive, mountpoint ) | + | success = love.filesystem.mount( archive, mountpoint, appendToPath ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
{{param|string|archive|The folder or zip file in the game's save directory to mount.}} | {{param|string|archive|The folder or zip file in the game's save directory to mount.}} | ||
{{param|string|mountpoint|The new path the archive will be mounted to.}} | {{param|string|mountpoint|The new path the archive will be mounted to.}} | ||
+ | {{param|boolean|appendToPath (false)|Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.}} | ||
=== Returns === | === Returns === | ||
{{param|boolean|success|True if the archive was successfully mounted, false otherwise.}} | {{param|boolean|success|True if the archive was successfully mounted, false otherwise.}} | ||
== Function == | == Function == | ||
+ | {{newin|[[11.0]]|110|type=variant}} | ||
+ | Mounts the contents of the given FileData in memory. The FileData's data must contain a zipped directory structure. | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | success = love.filesystem.mount( | + | success = love.filesystem.mount( filedata, mountpoint, appendToPath ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param| | + | {{param|FileData|filedata|The FileData object in memory to mount.}} |
{{param|string|mountpoint|The new path the archive will be mounted to.}} | {{param|string|mountpoint|The new path the archive will be mounted to.}} | ||
{{param|boolean|appendToPath (false)|Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.}} | {{param|boolean|appendToPath (false)|Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.}} | ||
+ | === Returns === | ||
+ | {{param|boolean|success|True if the archive was successfully mounted, false otherwise.}} | ||
+ | == Function == | ||
+ | {{newin|[[11.0]]|110|type=variant}} | ||
+ | Mounts the contents of the given Data object in memory. The data must contain a zipped directory structure. | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | success = love.filesystem.mount( data, archivename, mountpoint, appendToPath ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|Data|data|The Data object in memory to mount.}} | ||
+ | {{param|string|archivename|The name to associate the mounted data with, for use with [[love.filesystem.unmount]]. Must be unique compared to other mounted data.}} | ||
+ | {{param|string|mountpoint|The new path the archive will be mounted to.}} | ||
+ | {{param|boolean|appendToPath (false)|Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.}} | ||
=== Returns === | === Returns === | ||
{{param|boolean|success|True if the archive was successfully mounted, false otherwise.}} | {{param|boolean|success|True if the archive was successfully mounted, false otherwise.}} | ||
Line 32: | Line 50: | ||
love.filesystem.mount("content.zip", "content") | love.filesystem.mount("content.zip", "content") | ||
− | assert(love.filesystem. | + | assert(love.filesystem.getInfo("content/myimage.png") ~= nil) |
</source> | </source> | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love.filesystem]] | * [[parent::love.filesystem]] | ||
* [[love.filesystem.unmount]] | * [[love.filesystem.unmount]] | ||
* [[love.filesystem.getSourceBaseDirectory]] | * [[love.filesystem.getSourceBaseDirectory]] | ||
+ | * [[love.directorydropped]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Mounts a zip file or folder in the game's save directory for reading.}} | {{#set:Description=Mounts a zip file or folder in the game's save directory for reading.}} | ||
== Other Languages == | == Other Languages == | ||
{{i18n|love.filesystem.mount}} | {{i18n|love.filesystem.mount}} |
Latest revision as of 02:45, 26 September 2024
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Mounts a zip file or folder in the game's save directory for reading. It is also possible to mount love.filesystem.getSourceBaseDirectory if the game is in fused mode.
Contents
Function
Synopsis
success = love.filesystem.mount( archive, mountpoint, appendToPath )
Arguments
string archive
- The folder or zip file in the game's save directory to mount.
string mountpoint
- The new path the archive will be mounted to.
boolean appendToPath (false)
- Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.
Returns
boolean success
- True if the archive was successfully mounted, false otherwise.
Function
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Mounts the contents of the given FileData in memory. The FileData's data must contain a zipped directory structure.
Synopsis
success = love.filesystem.mount( filedata, mountpoint, appendToPath )
Arguments
FileData filedata
- The FileData object in memory to mount.
string mountpoint
- The new path the archive will be mounted to.
boolean appendToPath (false)
- Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.
Returns
boolean success
- True if the archive was successfully mounted, false otherwise.
Function
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Mounts the contents of the given Data object in memory. The data must contain a zipped directory structure.
Synopsis
success = love.filesystem.mount( data, archivename, mountpoint, appendToPath )
Arguments
Data data
- The Data object in memory to mount.
string archivename
- The name to associate the mounted data with, for use with love.filesystem.unmount. Must be unique compared to other mounted data.
string mountpoint
- The new path the archive will be mounted to.
boolean appendToPath (false)
- Whether the archive will be searched when reading a filepath before or after already-mounted archives. This includes the game's source and save directories.
Returns
boolean success
- True if the archive was successfully mounted, false otherwise.
Examples
Mount a zip file.
-- Assuming content.zip exists in the game's save directory and contains a file called 'myimage.png'.
love.filesystem.mount("content.zip", "content")
assert(love.filesystem.getInfo("content/myimage.png") ~= nil)
See Also
- love.filesystem
- love.filesystem.unmount
- love.filesystem.getSourceBaseDirectory
- love.directorydropped
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