aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-04 10:05:35 +0100
committerKim Alvefur <zash@zash.se>2016-02-04 10:05:35 +0100
commit2ab1810f7d42d0aaae8e2307111fc1421d347978 (patch)
treebd56fb1dab20f4e0c55f327f5ef9929459e0988d
parentde372ae2452684e5a9de1b41e5f14bcda0bbe8d9 (diff)
downloadprosody-2ab1810f7d42d0aaae8e2307111fc1421d347978.tar.gz
prosody-2ab1810f7d42d0aaae8e2307111fc1421d347978.zip
moduleapi: Add API method for getting a file path
-rw-r--r--core/moduleapi.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index c439ba6f..573f3153 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -301,6 +301,20 @@ function api:get_option_inherited_set(name, ...)
return value;
end
+function api:get_option_path(name, default, parent)
+ if parent == nil then
+ parent = parent or self:get_directory();
+ elseif prosody.paths[parent] then
+ parent = prosody.paths[parent];
+ end
+ local value = self:get_option_string(name, default);
+ if value == nil then
+ return nil;
+ end
+ return resolve_relative_path(parent, value);
+end
+
+
function api:context(host)
return setmetatable({host=host or "*"}, {__index=self,__newindex=self});
end