Diff

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
line wrap: on
line diff
--- a/core/configmanager.lua	Wed Sep 12 22:03:06 2012 +0500
+++ b/core/configmanager.lua	Thu Sep 13 18:31:34 2012 +0100
@@ -247,11 +247,10 @@
 					end
 				end
 			else
+				local file = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file);
 				local f, err = io.open(file);
 				if f then
-					local data = f:read("*a");
-					local file = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file);
-					local ret, err = parsers.lua.load(data, file, config);
+					local ret, err = parsers.lua.load(f:read("*a"), file, config);
 					if not ret then error(err:gsub("%[string.-%]", file), 0); end
 				end
 				if not f then error("Error loading included "..file..": "..err, 0); end