summaryrefslogtreecommitdiff
path: root/lualibs-file.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-23 14:45:17 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-23 14:45:17 +0200
commitc437a26a8c912b66cb51ce90b95dc05f0a5d9fc4 (patch)
tree64a8366599b2e352c251f8e84e907d8c37c152e2 /lualibs-file.lua
parent2345a389998dca5c3ca0317cee42346b16eb24d0 (diff)
downloadlualibs-c437a26a8c912b66cb51ce90b95dc05f0a5d9fc4.tar.gz
sync with Context as of 2013-05-23v2.0b
Diffstat (limited to 'lualibs-file.lua')
-rw-r--r--lualibs-file.lua19
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