Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pattern for lfs.dir on WIN32 #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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