Fixed issue with os.matchfiles and symlinks
This commit is contained in:
parent
2cee14c124
commit
ce186b1292
@ -161,9 +161,10 @@ int os_matchisfile(lua_State* L)
|
||||
{
|
||||
MatchInfo* m = (MatchInfo*)lua_touserdata(L, 1);
|
||||
#if defined(_DIRENT_HAVE_D_TYPE)
|
||||
if (m->entry->d_type != DT_UNKNOWN)
|
||||
// Dirent marks symlinks as DT_LNK, not (DT_LNK|DT_DIR). The fallback handles symlinks using stat.
|
||||
if (m->entry->d_type == DT_DIR)
|
||||
{
|
||||
lua_pushboolean(L, (m->entry->d_type == DT_DIR) == 0);
|
||||
lua_pushboolean(L, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -124,6 +124,20 @@
|
||||
test.istrue(table.contains(result, "folder/subfolder/hello.txt"))
|
||||
end
|
||||
|
||||
function suite.matchfiles_onSymbolicLink()
|
||||
if os.istarget("macosx")
|
||||
or os.istarget("linux")
|
||||
or os.istarget("solaris")
|
||||
or os.istarget("bsd")
|
||||
then
|
||||
os.execute("cd folder && ln -s subfolder symlinkfolder && cd ..")
|
||||
local result = os.matchfiles("folder/**/*.txt")
|
||||
os.execute("rm folder/symlinkfolder")
|
||||
premake.modules.self_test.print(table.tostring(result))
|
||||
test.istrue(table.contains(result, "folder/symlinkfolder/hello.txt"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- os.pathsearch() tests
|
||||
|
Loading…
Reference in New Issue
Block a user