Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ static int dir_close (lua_State *L) {
*/
static int dir_iter_factory (lua_State *L) {
const char *path = luaL_checkstring (L, 1);
#ifdef _WIN32
const char *pattern = luaL_optstring(L, 2, "*");
#endif
dir_data *d;
lua_pushcfunction (L, dir_iter);
d = (dir_data *) lua_newuserdata (L, sizeof(dir_data));
Expand All @@ -556,7 +559,7 @@ static int dir_iter_factory (lua_State *L) {
if (strlen(path) > MAX_PATH-2)
luaL_error (L, "path too long: %s", path);
else
sprintf (d->pattern, "%s/*", path);
sprintf (d->pattern, "%s/%s", path, pattern);
#else
d->dir = opendir (path);
if (d->dir == NULL)
Expand Down