Commit d4677bd8 authored by Carlos Juliano Viana's avatar Carlos Juliano Viana
Browse files

Adicionando função locarecursiva para criar diretório usando essa funçÃ...

Adicionando função locarecursiva para criar diretório  usando essa funçà para criar os diretÃrios de runtime e sandbox.

[SOMA-3993]
[SOMA-2554]
parent d7b65fa4
......@@ -36,6 +36,18 @@ local function make_logger(ident)
end))
end
local function rmkdir(fullpath)
if lfs.attributes(fullpath, "mode") ~= nil then
return true
end
local basename = fullpath:gsub("[^/]+/*$", "")
if string.find(basename, "%S") ~= nil then
local ok, err = rmkdir(basename)
if not ok then return nil, err end
end
return lfs.mkdir(fullpath)
end
--[[
Application architecture:
......@@ -59,7 +71,7 @@ end
--]]
function application.new(config)
local ok, err = lfs.mkdir(config.runtime_data_dir)
local ok, err = rmkdir(config.runtime_data_dir)
if not ok then
local attr = lfs.attributes(config.runtime_data_dir)
if not (attr and attr.mode == "directory") then
......@@ -67,7 +79,7 @@ function application.new(config)
end
end
local ok, err = lfs.mkdir(config.sandbox_root_dir)
local ok, err = rmkdir(config.sandbox_root_dir)
if not ok then
local attr = lfs.attributes(config.sandbox_root_dir)
if not (attr and attr.mode == "directory") then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment