mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Removed love.filesystem.exists (resolves issue #641.)
Use either love.filesystem.isFile or love.filesystem.isDirectory instead. --HG-- branch : minor
This commit is contained in:
@@ -407,19 +407,14 @@ std::string Filesystem::getRealDirectory(const char *filename) const
|
||||
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)
|
||||
|
||||
@@ -172,21 +172,13 @@ public:
|
||||
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;
|
||||
|
||||
@@ -233,13 +233,6 @@ int w_getSourceBaseDirectory(lua_State *L)
|
||||
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);
|
||||
@@ -463,7 +456,7 @@ int loader(lua_State *L)
|
||||
}
|
||||
|
||||
// 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());
|
||||
@@ -484,7 +477,7 @@ int loader(lua_State *L)
|
||||
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());
|
||||
@@ -591,7 +584,6 @@ static const luaL_Reg functions[] =
|
||||
{ "getAppdataDirectory", w_getAppdataDirectory },
|
||||
{ "getSaveDirectory", w_getSaveDirectory },
|
||||
{ "getSourceBaseDirectory", w_getSourceBaseDirectory },
|
||||
{ "exists", w_exists },
|
||||
{ "isDirectory", w_isDirectory },
|
||||
{ "isFile", w_isFile },
|
||||
{ "createDirectory", w_createDirectory },
|
||||
|
||||
@@ -50,7 +50,6 @@ int w_getUserDirectory(lua_State *L);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user