summaryrefslogtreecommitdiff
path: root/tex/context/base/l-dir.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-02-01 15:40:12 +0200
committerMarius <mariausol@gmail.com>2011-02-01 15:40:12 +0200
commit1e6ba021602441d20ced70966de1037d7ce186ee (patch)
tree185ab01d3837ca02b42fc78a57450dfc3eec7525 /tex/context/base/l-dir.lua
parentf98e3683d79d780676482f9534b3189690880c21 (diff)
downloadcontext-1e6ba021602441d20ced70966de1037d7ce186ee.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