Changeset

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
parents 5118:0dc9e6c128c3
children 5125:cdbc86b69ea2 5126:a0673b644f05
files core/configmanager.lua
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
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