52 local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end |
52 local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end |
53 local _mkdir = {} |
53 local _mkdir = {} |
54 function mkdir(path) |
54 function mkdir(path) |
55 path = path:gsub("/", path_separator); |
55 path = path:gsub("/", path_separator); |
56 --print("mkdir",path); |
56 --print("mkdir",path); |
57 local x = io.popen("mkdir "..path.." 2>&1"):read("*a"); |
57 local x = io.popen("mkdir \""..path.."\" 2>&1"):read("*a"); |
58 end |
58 end |
59 function encode(s) return s and (s:gsub("%W", function (c) return string.format("%%%x", c:byte()); end)); end |
59 function encode(s) return s and (s:gsub("%W", function (c) return string.format("%%%x", c:byte()); end)); end |
60 function mkdirs(host) |
60 function mkdirs(host) |
61 if not _mkdir[host] then |
61 if not _mkdir[host] then |
62 local host_dir = string.format("%s/%s", data_path, encode(host)); |
62 local host_dir = string.format("%s/%s", data_path, encode(host)); |