diff options
author | Jason Perkins <starkos@industriousone.com> | 2014-04-24 18:44:03 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2014-04-24 18:44:03 +0400 |
commit | b27d1accb89968833ee089e6544030829ca74ec0 (patch) | |
tree | c5621454e0904de07e258c903893b21f6cf9c9c3 /src/host | |
parent | 6b21344759a95fa95f40f2b36a842f6f5ac25bb1 (diff) |
Fix issue #20 - can now find files with a dot prefix; directories are still ignored
Diffstat (limited to 'src/host')
-rw-r--r-- | src/host/os_match.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/host/os_match.c b/src/host/os_match.c index a267381..5ccc04d 100644 --- a/src/host/os_match.c +++ b/src/host/os_match.c @@ -57,9 +57,10 @@ int os_matchisfile(lua_State* L) int os_matchnext(lua_State* L) { MatchInfo* m = (MatchInfo*)lua_touserdata(L, 1); - if (m->handle == INVALID_HANDLE_VALUE) + if (m->handle == INVALID_HANDLE_VALUE) { return 0; - + } + while (m) /* loop forever */ { if (!m->is_first) @@ -69,11 +70,8 @@ int os_matchnext(lua_State* L) } m->is_first = 0; - if (m->entry.cFileName[0] != '.') - { - lua_pushboolean(L, 1); - return 1; - } + lua_pushboolean(L, 1); + return 1; } return 0; @@ -155,7 +153,7 @@ int os_matchisfile(lua_State* L) lua_pushboolean(L, S_ISREG(info.st_mode)); return 1; } - + return 0; } @@ -164,12 +162,12 @@ int os_matchnext(lua_State* L) MatchInfo* m = (MatchInfo*)lua_touserdata(L, 1); if (m->handle == NULL) return 0; - + m->entry = readdir(m->handle); while (m->entry != NULL) { const char* name = m->entry->d_name; - if (name[0] != '.' && fnmatch(m->mask, name, 0) == 0) + if (fnmatch(m->mask, name, 0) == 0) { lua_pushboolean(L, 1); return 1; |