mod_component: Remove unused variable
[prosody.git] / core / configmanager.lua
index 839927dff59a2f7535ebc8b3d2dc4117b1ac03ce..e2253171a7459805956690174a6199d158ca4986 100644 (file)
@@ -41,12 +41,24 @@ function getconfig()
 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
@@ -79,7 +91,7 @@ do
                        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
@@ -221,10 +233,11 @@ do
                        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