summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/l-file.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/l-file.lua38
1 files changed, 16 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-file.lua b/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
index 46b6847d331..5fec0040fb1 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/l-file.lua
@@ -69,34 +69,35 @@ local lpegmatch = lpeg.match
local getcurrentdir, attributes = lfs.currentdir, lfs.attributes
local checkedsplit = string.checkedsplit
+-- local patterns = file.patterns or { }
+-- file.patterns = patterns
+
local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Ct
-- better this way:
------ tricky = S("/\\") * P(-1)
+local tricky = S("/\\") * P(-1)
local attributes = lfs.attributes
+if sandbox then
+ sandbox.redefine(lfs.isfile,"lfs.isfile")
+ sandbox.redefine(lfs.isdir, "lfs.isdir")
+end
+
function lfs.isdir(name)
- -- if not lpegmatch(tricky,name) then
- -- name = name .. "/."
- -- end
- return attributes(name,"mode") == "directory"
+ if lpegmatch(tricky,name) then
+ return attributes(name,"mode") == "directory"
+ else
+ return attributes(name.."/.","mode") == "directory"
+ end
end
function lfs.isfile(name)
- local a = attributes(name,"mode")
- return a == "file" or a == "link" or nil
+ return attributes(name,"mode") == "file"
end
function lfs.isfound(name)
- local a = attributes(name,"mode")
- return (a == "file" or a == "link") and name or nil
-end
-
-if sandbox then
- sandbox.redefine(lfs.isfile,"lfs.isfile")
- sandbox.redefine(lfs.isdir, "lfs.isdir")
- sandbox.redefine(lfs.isfound, "lfs.isfound")
+ return attributes(name,"mode") == "file" and name or nil
end
local colon = P(":")
@@ -724,10 +725,3 @@ function file.withinbase(path) -- don't go beyond root
return true
end
--- not used in context but was in luatex once:
-
-local symlinkattributes = lfs.symlinkattributes
-
-function lfs.readlink(name)
- return symlinkattributes(name,"target") or nil
-end