Changeset

6166:46cb87d531a7

configmanager: Delay importing LuaFileSystem until needed by an Include line
author Kim Alvefur <zash@zash.se>
date Fri, 09 May 2014 19:59:49 +0200
parents 6155:dc3497041aca
children 6167:5af7fe1014db 6279:16d5b55c8d8d
files core/configmanager.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/configmanager.lua	Fri Apr 25 02:41:55 2014 +0200
+++ b/core/configmanager.lua	Fri May 09 19:59:49 2014 +0200
@@ -14,7 +14,7 @@
 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 @@
 		
 		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.."]+$", "");