end
function get(host, section, key)
+ if not key then
+ section, key = "core", section;
+ end
local sec = config[host][section];
if sec then
return sec[key];
end
return nil;
end
+function _M.rawget(host, section, key)
+ local hostconfig = rawget(config, host);
+ if hostconfig then
+ local sectionconfig = rawget(hostconfig, section);
+ if sectionconfig then
+ return rawget(sectionconfig, key);
+ end
+ end
+end
local function set(config, host, section, key, value)
if host and section and key then
local is_relative;
if path_sep == "/" and path:sub(1,1) ~= "/" then
is_relative = true;
- elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\") then
+ elseif path_sep == "\\" and (path:sub(1,1) ~= "/" and (path:sub(2,3) ~= ":\\" or path:sub(2,3) ~= ":/")) then
is_relative = true;
end
if is_relative then
if file:match("[*?]") then
local path_pos, glob = file:match("()([^"..path_sep.."]+)$");
local path = file:sub(1, math_max(path_pos-2,0));
+ local config_path = config_file:gsub("[^"..path_sep.."]+$", "");
if #path > 0 then
- path = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), path);
+ path = resolve_relative_path(config_path, path);
else
- path = ".";
+ path = config_path;
end
local patt = glob_to_pattern(glob);
for f in lfs.dir(path) do