Browse Source

Add love.filesystem.getIdentity

Bart van Strien 13 years ago
parent
commit
dd04074d62

+ 5 - 0
src/modules/filesystem/physfs/Filesystem.cpp

@@ -104,6 +104,11 @@ namespace physfs
 		return true;
 		return true;
 	}
 	}
 
 
+	const char * Filesystem::getIdentity() const
+	{
+		return save_identity.c_str();
+	}
+
 	bool Filesystem::setSource(const char * source)
 	bool Filesystem::setSource(const char * source)
 	{
 	{
 		if (!isInited)
 		if (!isInited)

+ 1 - 0
src/modules/filesystem/physfs/Filesystem.h

@@ -135,6 +135,7 @@ namespace physfs
 		* to create the folder in the LOVE data folder.
 		* to create the folder in the LOVE data folder.
 		**/
 		**/
 		bool setIdentity(const char * ident);
 		bool setIdentity(const char * ident);
+		const char * getIdentity() const;
 
 
 		/**
 		/**
 		* Sets the path to the game source.
 		* Sets the path to the game source.

+ 7 - 0
src/modules/filesystem/physfs/wrap_Filesystem.cpp

@@ -70,6 +70,12 @@ namespace physfs
 		return 0;
 		return 0;
 	}
 	}
 
 
+	int w_getIdentity(lua_State * L)
+	{
+		lua_pushstring(L, instance->getIdentity());
+		return 1;
+	}
+
 	int w_setSource(lua_State * L)
 	int w_setSource(lua_State * L)
 	{
 	{
 		const char * arg = luaL_checkstring(L, 1);
 		const char * arg = luaL_checkstring(L, 1);
@@ -369,6 +375,7 @@ namespace physfs
 		{ "init",  w_init },
 		{ "init",  w_init },
 		{ "setRelease", w_setRelease },
 		{ "setRelease", w_setRelease },
 		{ "setIdentity",  w_setIdentity },
 		{ "setIdentity",  w_setIdentity },
+		{ "getIdentity", w_getIdentity },
 		{ "setSource",  w_setSource },
 		{ "setSource",  w_setSource },
 		{ "newFile",  w_newFile },
 		{ "newFile",  w_newFile },
 		{ "getWorkingDirectory",  w_getWorkingDirectory },
 		{ "getWorkingDirectory",  w_getWorkingDirectory },

+ 1 - 0
src/modules/filesystem/physfs/wrap_Filesystem.h

@@ -39,6 +39,7 @@ namespace physfs
 	int w_init(lua_State * L);
 	int w_init(lua_State * L);
 	int w_setRelease(lua_State * L);
 	int w_setRelease(lua_State * L);
 	int w_setIdentity(lua_State * L);
 	int w_setIdentity(lua_State * L);
+	int w_getIdentity(lua_State * L);
 	int w_setSource(lua_State * L);
 	int w_setSource(lua_State * L);
 	int w_newFile(lua_State * L);
 	int w_newFile(lua_State * L);
 	int w_newFileData(lua_State * L);
 	int w_newFileData(lua_State * L);