prosodyctl: Fix import of util.iterators
[prosody.git] / core / moduleapi.lua
index 703eb2682678a402c02363e77518be942caa947e..57367255a32d285321a09225f3d0719ab8c23502 100644 (file)
@@ -329,4 +329,14 @@ function api:add_timer(delay, callback)
        end);
 end
 
+local path_sep = package.config:sub(1,1);
+function api:get_directory()
+       return self.path and (self.path:gsub("%"..path_sep.."[^"..path_sep.."]*$", "")) or nil;
+end
+
+function api:load_resource(path, mode)
+       path = config.resolve_relative_path(self:get_directory(), path);
+       return io.open(path, mode);
+end
+
 return api;