1. Bart van Strien
  2. love-experiments

Commits

Alex Szpakowski  committed e6c4010

Removed love.filesystem.exists (resolves issue #641.)

Use either love.filesystem.isFile or love.filesystem.isDirectory instead.

  • Participants
  • Parent commits 219bfb3
  • Branches minor

Comments (0)

Files changed (4)

File src/modules/filesystem/physfs/Filesystem.cpp

View file
 	return std::string(dir);
 }
 
-bool Filesystem::exists(const char *file) const
+bool Filesystem::isDirectory(const char *dir) const
 {
-	return PHYSFS_exists(file);
-}
-
-bool Filesystem::isDirectory(const char *file) const
-{
-	return PHYSFS_isDirectory(file);
+	return PHYSFS_isDirectory(dir);
 }
 
 bool Filesystem::isFile(const char *file) const
 {
-	return exists(file) && !isDirectory(file);
+	return PHYSFS_exists(file) && !PHYSFS_isDirectory(file);
 }
 
 bool Filesystem::createDirectory(const char *dir)

File src/modules/filesystem/physfs/Filesystem.h

View file
 	std::string getRealDirectory(const char *filename) const;
 
 	/**
-	 * Checks whether a file exists in the current search path
-	 * or not.
-	 * @param file The filename to check.
+	 * Checks if a path is a directory.
+	 * @param dir The directory name to check.
 	 **/
-	bool exists(const char *file) const;
+	bool isDirectory(const char *dir) const;
 
 	/**
-	 * Checks if an existing file really is a directory.
-	 * @param file The filename to check.
-	 **/
-	bool isDirectory(const char *file) const;
-
-	/**
-	 * Checks if an existing file really is a file,
-	 * and not a directory.
+	 * Checks if a filename exists.
 	 * @param file The filename to check.
 	 **/
 	bool isFile(const char *file) const;

File src/modules/filesystem/physfs/wrap_Filesystem.cpp

View file
 	return 1;
 }
 
-int w_exists(lua_State *L)
-{
-	const char *arg = luaL_checkstring(L, 1);
-	luax_pushboolean(L, instance->exists(arg));
-	return 1;
-}
-
 int w_isDirectory(lua_State *L)
 {
 	const char *arg = luaL_checkstring(L, 1);
 	}
 
 	// Check whether file exists.
-	if (instance->exists(tmp.c_str()))
+	if (instance->isFile(tmp.c_str()))
 	{
 		lua_pop(L, 1);
 		lua_pushstring(L, tmp.c_str());
 	if (instance->isDirectory(tmp.c_str()))
 	{
 		tmp += "/init.lua";
-		if (instance->exists(tmp.c_str()))
+		if (instance->isFile(tmp.c_str()))
 		{
 			lua_pop(L, 1);
 			lua_pushstring(L, tmp.c_str());
 	{ "getAppdataDirectory",  w_getAppdataDirectory },
 	{ "getSaveDirectory",  w_getSaveDirectory },
 	{ "getSourceBaseDirectory", w_getSourceBaseDirectory },
-	{ "exists",  w_exists },
 	{ "isDirectory",  w_isDirectory },
 	{ "isFile",  w_isFile },
 	{ "createDirectory",  w_createDirectory },

File src/modules/filesystem/physfs/wrap_Filesystem.h

View file
 int w_getAppdataDirectory(lua_State *L);
 int w_getSaveDirectory(lua_State *L);
 int w_getSourceBaseDirectory(lua_State *L);
-int w_exists(lua_State *L);
 int w_isDirectory(lua_State *L);
 int w_isFile(lua_State *L);
 int w_createDirectory(lua_State *L);