From f60e809b87c6d9b0ea87ceeb54507d486f2934eb Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 26 Jul 2014 12:46:53 +0200 Subject: sync with Context as of 2014-07-26 --- lualibs-dir.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lualibs-dir.lua') 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) -- cgit v1.2.3