mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
love.filesystem.isFile and isDirectory behave consistently between PhysFS 2.0 and 2.1/3.0 (see issue #641).
--HG-- branch : minor
This commit is contained in:
@@ -586,7 +586,7 @@ bool Filesystem::isDirectory(const char *dir) const
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return PHYSFS_isDirectory(dir) != 0;
|
return PHYSFS_isDirectory(dir) != 0 && !isSymlink(dir);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +595,15 @@ bool Filesystem::isFile(const char *file) const
|
|||||||
if (!PHYSFS_isInit())
|
if (!PHYSFS_isInit())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return PHYSFS_exists(file) && !isDirectory(file);
|
#ifdef LOVE_USE_PHYSFS_2_1
|
||||||
|
PHYSFS_Stat stat = {};
|
||||||
|
if (PHYSFS_stat(file, &stat))
|
||||||
|
return stat.filetype == PHYSFS_FILETYPE_REGULAR;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return PHYSFS_exists(file) && !isDirectory(file) && !isSymlink(file);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Filesystem::isSymlink(const char *filename) const
|
bool Filesystem::isSymlink(const char *filename) const
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ int w_newImageData(lua_State *L)
|
|||||||
t->release();
|
t->release();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (filesystem::luax_cangetfiledata(L, 1) || luax_istype(L, 1, Data::type)) // Case 2: File(Data).
|
else if (filesystem::luax_cangetdata(L, 1)) // Case 2: File(Data).
|
||||||
{
|
{
|
||||||
Data *data = love::filesystem::luax_getdata(L, 1);
|
Data *data = love::filesystem::luax_getdata(L, 1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user