diff options
author | Karl Berry <karl@freefriends.org> | 2014-07-26 23:05:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-07-26 23:05:53 +0000 |
commit | 10b0d2ae791ff3d0be1018559aa21dc7581ede6c (patch) | |
tree | 561becf41ab4fd13d10dfbd512396ee746afa132 /Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua | |
parent | f24688afffa8c38ec19dfb9cd0a0a3e5d4267f24 (diff) |
lualibs (26jul14)
git-svn-id: svn://tug.org/texlive/trunk@34736 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua index ebb2b39f4a2..c05372a053d 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua @@ -495,6 +495,23 @@ function file.collapsepath(str,anchor) -- anchor: false|nil, true, "." end end +-- better this way: + +local tricky = S("/\\") * P(-1) +local attributes = lfs.attributes + +function lfs.isdir(name) + if lpegmatch(tricky,name) then + return attributes(name,"mode") == "directory" + else + return attributes(name.."/.","mode") == "directory" + end +end + +function lfs.isfile(name) + return attributes(name,"mode") == "file" +end + -- local function test(str,...) -- print(string.format("%-20s %-15s %-30s %-20s",str,file.collapsepath(str),file.collapsepath(str,true),file.collapsepath(str,"."))) -- end |