[latex3-commits] [l3svn] 05/09: only find directories for patterns ending with /
noreply at latex-project.org
noreply at latex-project.org
Sun Jun 25 09:30:25 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 6ff795d4bcec10797383e82d8749b22ecf219262
Author: XZS <d.f.fischer at web.de>
Date: Fri Apr 14 19:18:02 2017 +0200
only find directories for patterns ending with /
Refraining from the useless attempt to extend files with further
filename components speeds up the search. Patterns can now also be
finished with a slash to restrict them to directories, similar to how
many shells do it.
---
l3build/l3build.lua | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/l3build/l3build.lua b/l3build/l3build.lua
index 14ba64e..bba82a4 100644
--- a/l3build/l3build.lua
+++ b/l3build/l3build.lua
@@ -570,13 +570,23 @@ function tree(path, glob)
function cropdots(path)
return gsub(gsub(path, "^%./", ""), "/%./", "/")
end
- dirs = {["."]=cropdots(path)}
- for pattern in gmatch(cropdots(glob), "[^/]+") do
+ function always_true()
+ return true
+ end
+ function is_dir(file)
+ return lfs.attributes(file)["mode"] == "directory"
+ end
+ 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
for _, file in ipairs(filelist(dir, pattern)) do
if file ~= "." and file ~= ".." then
- newdirs[path .. "/" .. file] = dir .. "/" .. file
+ local fulldir = dir .. "/" .. file
+ if critereon(fulldir) then
+ newdirs[path .. "/" .. file] = fulldir
+ end
end
end
end
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the latex3-commits
mailing list