Software /
code /
prosody
Comparison
core/moduleapi.lua @ 6165:6a184b16b717
core.certmanager, core.moduleapi, mod_storage_sql, mod_storage_sql2: Import from util.paths
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 09 May 2014 19:35:29 +0200 |
parent | 5825:ac5e05ffc921 |
child | 6168:3942630b4e35 |
child | 6414:31c15004bfb0 |
comparison
equal
deleted
inserted
replaced
6164:ef4024f6bc40 | 6165:6a184b16b717 |
---|---|
11 local array = require "util.array"; | 11 local array = require "util.array"; |
12 local set = require "util.set"; | 12 local set = require "util.set"; |
13 local logger = require "util.logger"; | 13 local logger = require "util.logger"; |
14 local pluginloader = require "util.pluginloader"; | 14 local pluginloader = require "util.pluginloader"; |
15 local timer = require "util.timer"; | 15 local timer = require "util.timer"; |
16 local resolve_relative_path = require"util.paths".resolve_relative_path; | |
16 | 17 |
17 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; | 18 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; |
18 local error, setmetatable, type = error, setmetatable, type; | 19 local error, setmetatable, type = error, setmetatable, type; |
19 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack; | 20 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack; |
20 local tonumber, tostring = tonumber, tostring; | 21 local tonumber, tostring = tonumber, tostring; |
358 function api:get_directory() | 359 function api:get_directory() |
359 return self.path and (self.path:gsub("%"..path_sep.."[^"..path_sep.."]*$", "")) or nil; | 360 return self.path and (self.path:gsub("%"..path_sep.."[^"..path_sep.."]*$", "")) or nil; |
360 end | 361 end |
361 | 362 |
362 function api:load_resource(path, mode) | 363 function api:load_resource(path, mode) |
363 path = config.resolve_relative_path(self:get_directory(), path); | 364 path = resolve_relative_path(self:get_directory(), path); |
364 return io.open(path, mode); | 365 return io.open(path, mode); |
365 end | 366 end |
366 | 367 |
367 function api:open_store(name, type) | 368 function api:open_store(name, type) |
368 return storagemanager.open(self.host, name or self.name, type); | 369 return storagemanager.open(self.host, name or self.name, type); |