summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2008-05-09 19:33:00 +0200
committerHans Hagen <pragma@wxs.nl>2008-05-09 19:33:00 +0200
commit3d7afaa86d4d170aacd4d287e70149d22172bf4f (patch)
treeb011663a8b36ddbfb0cdba99433e92920e23e79f /tex/context/base/l-dir.lua
parentd948cb4eddff16f17051d8078b4c55cdd8e8f681 (diff)
downloadcontext-3d7afaa86d4d170aacd4d287e70149d22172bf4f.tar.gz
stable 2008.05.09 19:33
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r--tex/context/base/l-dir.lua32
1 files changed, 19 insertions, 13 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index b6c70d264..d24eb33a9 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -127,21 +127,27 @@ if lfs then do
P(1)
)^0 )
- local function glob(str)
- local split = pattern:match(str)
- if split then
- local t = { }
- local action = action or function(name) t[#t+1] = name end
- local root, path, base = split[1], split[2], split[3]
- local recurse = base:find("**")
- local start = root .. path
- local result = filter:match(start .. base)
---~ print(str, start, result)
---~ print(start, result)
- glob_pattern(start,result,recurse,action)
+ local function glob(str,t)
+ if type(str) == "table" then
+ local t = t or { }
+ for _, s in ipairs(str) do
+ glob(s,t)
+ end
return t
else
- return { }
+ local split = pattern:match(str)
+ if split then
+ local t = t or { }
+ local action = action or function(name) t[#t+1] = name end
+ local root, path, base = split[1], split[2], split[3]
+ local recurse = base:find("**")
+ local start = root .. path
+ local result = filter:match(start .. base)
+ glob_pattern(start,result,recurse,action)
+ return t
+ else
+ return { }
+ end
end
end