summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/fs.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/fs.lua b/lib/fs.lua
index 5ad6e33..954ac0d 100644
--- a/lib/fs.lua
+++ b/lib/fs.lua
@@ -42,11 +42,14 @@ function is_link ( pathstr )
end
--- Creates a directory if it doesn't exist
+-- Creates a directory if it doesn't exist, including the parent dirs
function create_directory ( path )
- local cmd = "mkdir -p " .. format.escapespecialcharacters(path)
- local f = io.popen(cmd)
- f:close()
+ local p, i
+ p = ""
+ for i in string.gmatch(path, "/*[^/]+") do
+ p = p .. i
+ posix.mkdir(p)
+ end
return is_dir(path)
end