[latex3-commits] [l3svn] 06/09: provide ** globbing
noreply at latex-project.org
noreply at latex-project.org
Sun Jun 25 09:30:26 CEST 2017
This is an automated email from the git hooks/post-receive script.
joseph pushed a commit to branch master
in repository l3svn.
commit 39d0642e578c170f64973942bc9b5f95d3ee5c6c
Author: XZS <d.f.fischer at web.de>
Date: Fri Apr 14 19:50:58 2017 +0200
provide ** globbing
Many shells provide the double-star globbing operator to indicate any
directory equal or below the current position. A simple version of this
can be provided here, too. It is useful for example to unpack or typeset
all files with a certain suffix in a hierarchy.
---
l3build/l3build.lua | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/l3build/l3build.lua b/l3build/l3build.lua
index bba82a4..d2ed706 100644
--- a/l3build/l3build.lua
+++ b/l3build/l3build.lua
@@ -579,17 +579,32 @@ function tree(path, glob)
local dirs = {["."]=cropdots(path)}
for pattern, critereon in gmatch(cropdots(glob), "([^/]+)(/?)") do
local critereon = critereon == "/" and is_dir or always_true
- local newdirs = {}
- for path, dir in pairs(dirs) do
+ function fill(path, dir, table)
for _, file in ipairs(filelist(dir, pattern)) do
if file ~= "." and file ~= ".." then
local fulldir = dir .. "/" .. file
if critereon(fulldir) then
- newdirs[path .. "/" .. file] = fulldir
+ table[path .. "/" .. file] = fulldir
end
end
end
end
+ local newdirs = {}
+ if pattern == "**" then
+ while true do
+ path, dir = next(dirs)
+ if not path then
+ break
+ end
+ dirs[path] = nil
+ newdirs[path] = dir
+ fill(path, dir, dirs)
+ end
+ else
+ for path, dir in pairs(dirs) do
+ fill(path, dir, newdirs)
+ end
+ end
dirs = newdirs
end
return dirs
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the latex3-commits
mailing list