27 lines
524 B
Lua
27 lines
524 B
Lua
utils = {}
|
|
|
|
function utils.split (str, sep)
|
|
local new_table = {}
|
|
for v in string.gmatch(str, "([^"..sep.."]+)") do
|
|
table.insert(new_table, v)
|
|
end
|
|
return new_table
|
|
end
|
|
|
|
function utils.path_create(path)
|
|
|
|
local dirs = utils.split(path, "/")
|
|
table.remove(dirs)
|
|
local tmp = "";
|
|
for i, dir in ipairs(dirs) do
|
|
tmp = tmp .. dir
|
|
if not file.Exists(tmp, "DATA")
|
|
then
|
|
file.CreateDir(tmp)
|
|
end
|
|
tmp = tmp .. "/"
|
|
end
|
|
|
|
end
|
|
|
|
return utils |