Difference between revisions of "love.filesystem.setIdentity"

m (1 revision: Importing from potato (again).)
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
+
Sets the write directory for your game. Equivalent to the identity/appendidentity pair for conf.lua.
Sets the write directory for your game.  
 
 
Note that you can only set the name of the folder to store your files in, not the location.
 
Note that you can only set the name of the folder to store your files in, not the location.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
love.filesystem.setIdentity( name )
+
love.filesystem.setIdentity( name, appendToPath )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|string|name|The new identity that will be used as write directory}}
+
{{param|string|name|The new identity that will be used as write directory.}}
 +
{{New feature|0.9.0|
 +
{{param|boolean|appendToPath (false)|Whether the identity directory will be searched when reading a filepath before or after the game's source directory and any currently.
 +
TRUE: results in searching source before searching save directory;
 +
FALSE: results in searching game save directory before searching source directory [[love.filesystem.mount|mounted]] archives.}}
 +
|090}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
 
== Examples ==
 
== Examples ==
 
=== Setting the game folder name ===
 
=== Setting the game folder name ===
Line 17: Line 22:
 
love.filesystem.setIdentity("monkey_doom_2")
 
love.filesystem.setIdentity("monkey_doom_2")
 
-- No:  
 
-- No:  
-- love.filesystem.setIdentity("c:/Users/bob/monkey_doom_2")
+
love.filesystem.setIdentity("c:/Users/bob/monkey_doom_2")
 
</source>
 
</source>
 +
=== Setting which to search first ===
 +
<source lang="lua">
 +
--Search Source, then the save directory
 +
love.filesystem.setIdentity(love.filesystem.getIdentity(),true)
 +
--Search Save directory, then the Source Directory
 +
love.filesystem.setIdentity(love.filesystem.getIdentity(),false)
 +
</source>
 +
 
== See Also ==
 
== See Also ==
 
* [[parent::love.filesystem]]
 
* [[parent::love.filesystem]]
 +
* [[love.filesystem.getIdentity]]
 
[[Category:Functions]]
 
[[Category:Functions]]
{{#set:Description=Sets the write directory for your game.  
+
{{#set:Description=Sets the write directory for your game.}}
}}
+
{{#set:Since=000}}
 +
== Other Languages ==
 +
{{i18n|love.filesystem.setIdentity}}

Latest revision as of 11:10, 12 March 2022

Sets the write directory for your game. Equivalent to the identity/appendidentity pair for conf.lua. Note that you can only set the name of the folder to store your files in, not the location.

Function

Synopsis

love.filesystem.setIdentity( name, appendToPath )

Arguments

string name
The new identity that will be used as write directory.
Available since LÖVE 0.9.0
boolean appendToPath (false)
Whether the identity directory will be searched when reading a filepath before or after the game's source directory and any currently.

TRUE: results in searching source before searching save directory; FALSE: results in searching game save directory before searching source directory mounted archives.

Returns

Nothing.

Examples

Setting the game folder name

-- Yes:
love.filesystem.setIdentity("monkey_doom_2")
-- No: 
love.filesystem.setIdentity("c:/Users/bob/monkey_doom_2")

Setting which to search first

--Search Source, then the save directory
love.filesystem.setIdentity(love.filesystem.getIdentity(),true)
--Search Save directory, then the Source Directory
love.filesystem.setIdentity(love.filesystem.getIdentity(),false)

See Also


Other Languages