aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-11-10 19:50:07 +0000
committerMatthew Wild <mwild1@gmail.com>2010-11-10 19:50:07 +0000
commita7d5c56e52fbfa28d31e1aac3a2ddddc7103c846 (patch)
tree5964ded31053a41a2b9cafeeace082ea3a3e7330 /core/configmanager.lua
parent385fd64606ba2c860ce5bcd534a7de5f8bce4bd1 (diff)
downloadprosody-a7d5c56e52fbfa28d31e1aac3a2ddddc7103c846.tar.gz
prosody-a7d5c56e52fbfa28d31e1aac3a2ddddc7103c846.zip
configmanager: Update Include and RunScript directives to support paths relative to the (current!) config file
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index b9618f86..edd1366a 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -145,7 +145,7 @@ do
env = setmetatable({
Host = true, host = true, VirtualHost = true,
Component = true, component = true,
- Include = true, include = true, RunScript = dofile }, {
+ Include = true, include = true, RunScript = true }, {
__index = function (t, k)
return rawget(_G, k) or
function (settings_table)
@@ -205,6 +205,7 @@ do
local f, err = io.open(file);
if f then
local data = f:read("*a");
+ local file = resolve_relative_path(filename:gsub("[^"..path_sep.."]+$", ""), file);
local ok, err = parsers.lua.load(data, file);
if not ok then error(err:gsub("%[string.-%]", file), 0); end
end
@@ -213,6 +214,10 @@ do
end
env.include = env.Include;
+ function env.RunScript(file)
+ return dofile(resolve_relative_path(filename:gsub("[^"..path_sep.."]+$", ""), file));
+ end
+
local chunk, err = loadstring(data, "@"..filename);
if not chunk then