Add love.filesystem.getIdentity

This commit is contained in:
Bart van Strien
2012-06-01 17:31:44 +02:00
parent 1eb17f2376
commit dd04074d62
4 changed files with 14 additions and 0 deletions
@@ -104,6 +104,11 @@ namespace physfs
return true;
}
const char * Filesystem::getIdentity() const
{
return save_identity.c_str();
}
bool Filesystem::setSource(const char * source)
{
if (!isInited)
@@ -135,6 +135,7 @@ namespace physfs
* to create the folder in the LOVE data folder.
**/
bool setIdentity(const char * ident);
const char * getIdentity() const;
/**
* Sets the path to the game source.
@@ -70,6 +70,12 @@ namespace physfs
return 0;
}
int w_getIdentity(lua_State * L)
{
lua_pushstring(L, instance->getIdentity());
return 1;
}
int w_setSource(lua_State * L)
{
const char * arg = luaL_checkstring(L, 1);
@@ -369,6 +375,7 @@ namespace physfs
{ "init", w_init },
{ "setRelease", w_setRelease },
{ "setIdentity", w_setIdentity },
{ "getIdentity", w_getIdentity },
{ "setSource", w_setSource },
{ "newFile", w_newFile },
{ "getWorkingDirectory", w_getWorkingDirectory },
@@ -39,6 +39,7 @@ namespace physfs
int w_init(lua_State * L);
int w_setRelease(lua_State * L);
int w_setIdentity(lua_State * L);
int w_getIdentity(lua_State * L);
int w_setSource(lua_State * L);
int w_newFile(lua_State * L);
int w_newFileData(lua_State * L);