diff options
Diffstat (limited to 'lualibs-dir.lua')
-rw-r--r-- | lualibs-dir.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lualibs-dir.lua b/lualibs-dir.lua index 660529b..bcf28d0 100644 --- a/lualibs-dir.lua +++ b/lualibs-dir.lua @@ -36,9 +36,14 @@ if onwindows then -- lfs.isdir does not like trailing / -- lfs.dir accepts trailing / + local tricky = S("/\\") * P(-1) + isdir = function(name) - name = gsub(name,"([/\\]+)$","/.") - return attributes(name,"mode") == "directory" + if lpegmatch(tricky,name) then + return attributes(name,"mode") == "directory" + else + return attributes(name.."/.","mode") == "directory" + end end isfile = function(name) |