summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-02-01 14:24:00 +0100
committerHans Hagen <pragma@wxs.nl>2011-02-01 14:24:00 +0100
commitff391d3816591b47893a12b8ccc0eb90f4b70333 (patch)
tree98f959e3e0112b141d167a61a14c22038e501929 /tex/context/base/l-dir.lua
parentd28b07938185801b15689978a1ee38dcdad0f8d3 (diff)
downloadcontext-ff391d3816591b47893a12b8ccc0eb90f4b70333.tar.gz
beta 2011.02.01 14:24
Diffstat (limited to 'tex/context/base/l-dir.lua')
-rw-r--r--tex/context/base/l-dir.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/tex/context/base/l-dir.lua b/tex/context/base/l-dir.lua
index 2c4ff999b..878698b16 100644
--- a/tex/context/base/l-dir.lua
+++ b/tex/context/base/l-dir.lua
@@ -59,20 +59,22 @@ end
--~ end
local function globpattern(path,patt,recurse,action)
- if path == "/" then
- path = path .. "."
- elseif not find(path,"/$") then
- path = path .. '/'
- end
- for name in walkdir(path) do
- local full = path .. name
- local mode = attributes(full,'mode')
- if mode == 'file' then
- if find(full,patt) then
- action(full)
+ if isdir(path) then
+ if path == "/" then
+ path = path .. "."
+ elseif not find(path,"/$") then
+ path = path .. '/'
+ end
+ for name in walkdir(path) do
+ local full = path .. name
+ local mode = attributes(full,'mode')
+ if mode == 'file' then
+ if find(full,patt) then
+ action(full)
+ end
+ elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then
+ globpattern(full,patt,recurse,action)
end
- elseif recurse and (mode == "directory") and (name ~= '.') and (name ~= "..") then
- globpattern(full,patt,recurse,action)
end
end
end