mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +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);
|
return std::string(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Filesystem::exists(const char *file) const
|
bool Filesystem::isDirectory(const char *dir) const
|
||||||
{
|
{
|
||||||
return PHYSFS_exists(file);
|
return PHYSFS_isDirectory(dir);
|
||||||
}
|
|
||||||
|
|
||||||
bool Filesystem::isDirectory(const char *file) const
|
|
||||||
{
|
|
||||||
return PHYSFS_isDirectory(file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Filesystem::isFile(const char *file) const
|
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)
|
bool Filesystem::createDirectory(const char *dir)
|
||||||
|
|||||||
@@ -172,21 +172,13 @@ public:
|
|||||||
std::string getRealDirectory(const char *filename) const;
|
std::string getRealDirectory(const char *filename) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a file exists in the current search path
|
* Checks if a path is a directory.
|
||||||
* or not.
|
* @param dir The directory name to check.
|
||||||
* @param file The filename to check.
|
|
||||||
**/
|
**/
|
||||||
bool exists(const char *file) const;
|
bool isDirectory(const char *dir) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an existing file really is a directory.
|
* Checks if a filename exists.
|
||||||
* @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.
|
|
||||||
* @param file The filename to check.
|
* @param file The filename to check.
|
||||||
**/
|
**/
|
||||||
bool isFile(const char *file) const;
|
bool isFile(const char *file) const;
|
||||||
|
|||||||
@@ -233,13 +233,6 @@ int w_getSourceBaseDirectory(lua_State *L)
|
|||||||
return 1;
|
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)
|
int w_isDirectory(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *arg = luaL_checkstring(L, 1);
|
const char *arg = luaL_checkstring(L, 1);
|
||||||
@@ -463,7 +456,7 @@ int loader(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether file exists.
|
// Check whether file exists.
|
||||||
if (instance->exists(tmp.c_str()))
|
if (instance->isFile(tmp.c_str()))
|
||||||
{
|
{
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_pushstring(L, tmp.c_str());
|
lua_pushstring(L, tmp.c_str());
|
||||||
@@ -484,7 +477,7 @@ int loader(lua_State *L)
|
|||||||
if (instance->isDirectory(tmp.c_str()))
|
if (instance->isDirectory(tmp.c_str()))
|
||||||
{
|
{
|
||||||
tmp += "/init.lua";
|
tmp += "/init.lua";
|
||||||
if (instance->exists(tmp.c_str()))
|
if (instance->isFile(tmp.c_str()))
|
||||||
{
|
{
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_pushstring(L, tmp.c_str());
|
lua_pushstring(L, tmp.c_str());
|
||||||
@@ -591,7 +584,6 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getAppdataDirectory", w_getAppdataDirectory },
|
{ "getAppdataDirectory", w_getAppdataDirectory },
|
||||||
{ "getSaveDirectory", w_getSaveDirectory },
|
{ "getSaveDirectory", w_getSaveDirectory },
|
||||||
{ "getSourceBaseDirectory", w_getSourceBaseDirectory },
|
{ "getSourceBaseDirectory", w_getSourceBaseDirectory },
|
||||||
{ "exists", w_exists },
|
|
||||||
{ "isDirectory", w_isDirectory },
|
{ "isDirectory", w_isDirectory },
|
||||||
{ "isFile", w_isFile },
|
{ "isFile", w_isFile },
|
||||||
{ "createDirectory", w_createDirectory },
|
{ "createDirectory", w_createDirectory },
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ int w_getUserDirectory(lua_State *L);
|
|||||||
int w_getAppdataDirectory(lua_State *L);
|
int w_getAppdataDirectory(lua_State *L);
|
||||||
int w_getSaveDirectory(lua_State *L);
|
int w_getSaveDirectory(lua_State *L);
|
||||||
int w_getSourceBaseDirectory(lua_State *L);
|
int w_getSourceBaseDirectory(lua_State *L);
|
||||||
int w_exists(lua_State *L);
|
|
||||||
int w_isDirectory(lua_State *L);
|
int w_isDirectory(lua_State *L);
|
||||||
int w_isFile(lua_State *L);
|
int w_isFile(lua_State *L);
|
||||||
int w_createDirectory(lua_State *L);
|
int w_createDirectory(lua_State *L);
|
||||||
|
|||||||
Reference in New Issue
Block a user