Software / code / prosody
Comparison
core/moduleapi.lua @ 7127:27557dd7b460
moduleapi: Add API method for getting a file path
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 04 Feb 2016 10:05:35 +0100 |
| parent | 7115:805d068d2fd5 |
| child | 7141:362545c3f8bb |
| child | 7162:d0b64f1e4f5d |
comparison
equal
deleted
inserted
replaced
| 7125:631c47a65519 | 7127:27557dd7b460 |
|---|---|
| 299 end | 299 end |
| 300 value:include(global_value); | 300 value:include(global_value); |
| 301 return value; | 301 return value; |
| 302 end | 302 end |
| 303 | 303 |
| 304 function api:get_option_path(name, default, parent) | |
| 305 if parent == nil then | |
| 306 parent = parent or self:get_directory(); | |
| 307 elseif prosody.paths[parent] then | |
| 308 parent = prosody.paths[parent]; | |
| 309 end | |
| 310 local value = self:get_option_string(name, default); | |
| 311 if value == nil then | |
| 312 return nil; | |
| 313 end | |
| 314 return resolve_relative_path(parent, value); | |
| 315 end | |
| 316 | |
| 317 | |
| 304 function api:context(host) | 318 function api:context(host) |
| 305 return setmetatable({host=host or "*"}, {__index=self,__newindex=self}); | 319 return setmetatable({host=host or "*"}, {__index=self,__newindex=self}); |
| 306 end | 320 end |
| 307 | 321 |
| 308 function api:add_item(key, value) | 322 function api:add_item(key, value) |