Comparison

core/configmanager.lua @ 6167:5af7fe1014db

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Fri, 09 May 2014 23:28:09 +0200
parent 6164:ef4024f6bc40
parent 6166:46cb87d531a7
child 6326:a3b9496673ee
comparison
equal deleted inserted replaced
6165:6a184b16b717 6167:5af7fe1014db
12 local format, math_max = string.format, math.max; 12 local format, math_max = string.format, math.max;
13 13
14 local fire_event = prosody and prosody.events.fire_event or function () end; 14 local fire_event = prosody and prosody.events.fire_event or function () end;
15 15
16 local envload = require"util.envload".envload; 16 local envload = require"util.envload".envload;
17 local lfs = require "lfs"; 17 local deps = require"util.dependencies";
18 local resolve_relative_path = require"util.paths".resolve_relative_path; 18 local resolve_relative_path = require"util.paths".resolve_relative_path;
19 local glob_to_pattern = require"util.paths".glob_to_pattern; 19 local glob_to_pattern = require"util.paths".glob_to_pattern;
20 local path_sep = package.config:sub(1,1); 20 local path_sep = package.config:sub(1,1);
21 21
22 module "configmanager" 22 module "configmanager"
181 end 181 end
182 env.component = env.Component; 182 env.component = env.Component;
183 183
184 function env.Include(file) 184 function env.Include(file)
185 if file:match("[*?]") then 185 if file:match("[*?]") then
186 local lfs = deps.softreq "lfs";
187 if not lfs then
188 error(format("Error expanding wildcard pattern in Include %q - LuaFileSystem not available", file));
189 end
186 local path_pos, glob = file:match("()([^"..path_sep.."]+)$"); 190 local path_pos, glob = file:match("()([^"..path_sep.."]+)$");
187 local path = file:sub(1, math_max(path_pos-2,0)); 191 local path = file:sub(1, math_max(path_pos-2,0));
188 local config_path = config_file:gsub("[^"..path_sep.."]+$", ""); 192 local config_path = config_file:gsub("[^"..path_sep.."]+$", "");
189 if #path > 0 then 193 if #path > 0 then
190 path = resolve_relative_path(config_path, path); 194 path = resolve_relative_path(config_path, path);