Comparison

core/configmanager.lua @ 5124:a4a74a0e9b9c

configmanager: Fix include of relative files via Include directive in config
author Matthew Wild <mwild1@gmail.com>
date Thu, 13 Sep 2012 18:31:34 +0100
parent 5021:85b2689dbcfe
child 5357:ac530c44772e
comparison
equal deleted inserted replaced
5118:0dc9e6c128c3 5124:a4a74a0e9b9c
245 if f:sub(1,1) ~= "." and f:match(patt) then 245 if f:sub(1,1) ~= "." and f:match(patt) then
246 env.Include(path..path_sep..f); 246 env.Include(path..path_sep..f);
247 end 247 end
248 end 248 end
249 else 249 else
250 local file = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file);
250 local f, err = io.open(file); 251 local f, err = io.open(file);
251 if f then 252 if f then
252 local data = f:read("*a"); 253 local ret, err = parsers.lua.load(f:read("*a"), file, config);
253 local file = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file);
254 local ret, err = parsers.lua.load(data, file, config);
255 if not ret then error(err:gsub("%[string.-%]", file), 0); end 254 if not ret then error(err:gsub("%[string.-%]", file), 0); end
256 end 255 end
257 if not f then error("Error loading included "..file..": "..err, 0); end 256 if not f then error("Error loading included "..file..": "..err, 0); end
258 return f, err; 257 return f, err;
259 end 258 end