configmanager: Delay importing LuaFileSystem until needed by an Include line

remotes/origin/0.11
Kim Alvefur 12 years ago
parent 92ed3576fc
commit eeacb3cb6f
  1. 6
      core/configmanager.lua

@ -14,7 +14,7 @@ local format, math_max = string.format, math.max;
local fire_event = prosody and prosody.events.fire_event or function () end;
local envload = require"util.envload".envload;
local lfs = require "lfs";
local deps = require"util.dependencies";
local path_sep = package.config:sub(1,1);
module "configmanager"
@ -214,6 +214,10 @@ do
function env.Include(file)
if file:match("[*?]") then
local lfs = deps.softreq "lfs";
if not lfs then
error(format("Error expanding wildcard pattern in Include %q - LuaFileSystem not available", file));
end
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.."]+$", "");

Loading…
Cancel
Save