diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-10-29 11:35:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-10-29 11:35:00 +0200 |
commit | 2e3932acbaa9da37885abbbd1f449a110c06f9a1 (patch) | |
tree | 3a4b1c5a08129cd5881cd8f8758b0ebd2fb4f80d /tex/context/base/l-dir.lua | |
parent | a1bbb1605334a1209f43625c174ba50ad698235e (diff) | |
download | context-2e3932acbaa9da37885abbbd1f449a110c06f9a1.tar.gz |
beta 2010.10.29 11:35
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r-- | tex/context/base/l-dir.lua | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua index 455f71b53..be21fb985 100644 --- a/tex/context/base/l-dir.lua +++ b/tex/context/base/l-dir.lua @@ -131,9 +131,12 @@ local function glob(str,t) end return t elseif isfile(str) then - local t = t or { } - t[#t+1] = str - return t + if t then + t[#t+1] = str + return t + else + return { str } + end else local split = lpegmatch(pattern,str) if split then @@ -166,6 +169,7 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function func = function(name) return find(name,s) end end files = files or { } + local noffiles = #files for name in walkdir(path) do if find(name,"^%.") then --- skip @@ -176,12 +180,9 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function globfiles(path .. "/" .. name,recurse,func,files) end elseif mode == "file" then - if func then - if func(name) then - files[#files+1] = path .. "/" .. name - end - else - files[#files+1] = path .. "/" .. name + if not func or func(name) then + noffiles = noffiles + 1 + files[noffiles] = path .. "/" .. name end end end |