diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-23 05:47:33 -0700 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-23 05:47:33 -0700 |
commit | ec6ddd136a1364a5c55e611cf6098c165b383ec0 (patch) | |
tree | 64a8366599b2e352c251f8e84e907d8c37c152e2 /lualibs-file.lua | |
parent | 814392cdbd7fb04508e8def277b9620d1254ab60 (diff) | |
parent | c437a26a8c912b66cb51ce90b95dc05f0a5d9fc4 (diff) | |
download | lualibs-ec6ddd136a1364a5c55e611cf6098c165b383ec0.tar.gz |
Merge pull request #13 from phi-gamma/master
sync
Diffstat (limited to 'lualibs-file.lua')
-rw-r--r-- | lualibs-file.lua | 19 |
1 files changed, 8 insertions, 11 deletions
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 |