diff options
Diffstat (limited to 'macros/luatex/generic/lualibs/lualibs-file.lua')
-rw-r--r-- | macros/luatex/generic/lualibs/lualibs-file.lua | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/macros/luatex/generic/lualibs/lualibs-file.lua b/macros/luatex/generic/lualibs/lualibs-file.lua index 1b039a4386..d0af94f09d 100644 --- a/macros/luatex/generic/lualibs/lualibs-file.lua +++ b/macros/luatex/generic/lualibs/lualibs-file.lua @@ -76,17 +76,27 @@ local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg local attributes = lfs.attributes function lfs.isdir(name) - return attributes(name,"mode") == "directory" + if name then + return attributes(name,"mode") == "directory" + end end function lfs.isfile(name) - local a = attributes(name,"mode") - return a == "file" or a == "link" or nil + if name then + local a = attributes(name,"mode") + return a == "file" or a == "link" or nil + end end function lfs.isfound(name) - local a = attributes(name,"mode") - return (a == "file" or a == "link") and name or nil + if name then + local a = attributes(name,"mode") + return (a == "file" or a == "link") and name or nil + end +end + +function lfs.modification(name) + return name and attributes(name,"modification") or nil end if sandbox then |