From c437a26a8c912b66cb51ce90b95dc05f0a5d9fc4 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 23 May 2013 14:45:17 +0200 Subject: sync with Context as of 2013-05-23 --- lualibs-file.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'lualibs-file.lua') diff --git a/lualibs-file.lua b/lualibs-file.lua index deaaca7..a64ee86 100644 --- a/lualibs-file.lua +++ b/lualibs-file.lua @@ -585,18 +585,15 @@ end -- end -- end --- a goodie: a dumb version of mkdirs: +-- a goodie: a dumb version of mkdirs (not used in context itself, only +-- in generic usage) function lfs.mkdirs(path) - local full - for sub in gmatch(path,"([^\\/]+)") do - if full then - full = full .. "/" .. sub - else - full = sub - end - if not lfs.isdir(full) then - lfs.mkdir(full) - end + local full = "" + for sub in gmatch(path,"(/*[^\\/]+)") do -- accepts leading c: and / + full = full .. sub + -- lfs.isdir("/foo") mistakenly returns true on windows so + -- so we don't test and just make as that one is not too picky + lfs.mkdir(full) end end -- cgit v1.2.3