Skip to content

Instantly share code, notes, and snippets.

@phst
Created December 31, 2010 20:16
Show Gist options
  • Save phst/761309 to your computer and use it in GitHub Desktop.
Save phst/761309 to your computer and use it in GitHub Desktop.
--- lualibs-dir.lua.orig 2010-12-31 21:09:07.000000000 +0100
+++ lualibs-dir.lua 2010-12-31 21:12:11.000000000 +0100
@@ -26,15 +26,15 @@
local walkdir = lfs.dir
local function glob_pattern(path,patt,recurse,action)
- local ok, scanner
+ local ok, scanner, dir_obj
if path == "/" then
- ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe
+ ok, scanner, dir_obj = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe
else
- ok, scanner = xpcall(function() return walkdir(path) end, function() end) -- kepler safe
+ ok, scanner, dir_obj = xpcall(function() return walkdir(path) end, function() end) -- kepler safe
end
if ok and type(scanner) == "function" then
if not find(path,"/$") then path = path .. '/' end
- for name in scanner do
+ for name in scanner, dir_obj do
local full = path .. name
local mode = attributes(full,'mode')
if mode == 'file' then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment