aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-01-10 23:13:30 +0000
committerMatthew Wild <mwild1@gmail.com>2010-01-10 23:13:30 +0000
commitd3a7681f7f7291f53a76a6c5f46757860af48449 (patch)
tree0befe12023071b73d04c8384f404485ef6c49bee /util
parent238beb4df640a6d2f1373f594842a56880c6ce78 (diff)
downloadprosody-d3a7681f7f7291f53a76a6c5f46757860af48449.tar.gz
prosody-d3a7681f7f7291f53a76a6c5f46757860af48449.zip
util.datamanager: Use pposix.mkdir if available
Diffstat (limited to 'util')
-rw-r--r--util/datamanager.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/util/datamanager.lua b/util/datamanager.lua
index 30cd082b..a2da0aa3 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -21,13 +21,19 @@ local next = next;
local t_insert = table.insert;
local append = require "util.serialization".append;
local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end
-local lfs_mkdir = require "lfs".mkdir;
+local raw_mkdir;
+
+if prosody.platform == "posix" then
+ raw_mkdir = require "util.pposix".mkdir; -- Doesn't trample on umask
+else
+ raw_mkdir = require "lfs".mkdir;
+end
module "datamanager"
---- utils -----
local encode, decode;
-do
+do
local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end });
decode = function (s)
@@ -43,7 +49,7 @@ local _mkdir = {};
local function mkdir(path)
path = path:gsub("/", path_separator); -- TODO as an optimization, do this during path creation rather than here
if not _mkdir[path] then
- lfs_mkdir(path);
+ raw_mkdir(path);
_mkdir[path] = true;
end
return path;