aboutsummaryrefslogtreecommitdiffstats
path: root/util/pluginloader.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2016-02-01 21:26:15 +0000
committerMatthew Wild <mwild1@gmail.com>2016-02-01 21:26:15 +0000
commitd0c5e1571fcd0d0242815c1076d56ecf917eec13 (patch)
tree4a2c3c9a40482459f4188df23e24ec989029b46c /util/pluginloader.lua
parent684aa3187fc5d2a759bd98459d829cf3ed7f04df (diff)
downloadprosody-d0c5e1571fcd0d0242815c1076d56ecf917eec13.tar.gz
prosody-d0c5e1571fcd0d0242815c1076d56ecf917eec13.zip
modulemanager, util.pluginloader: Move logic for locating some module libraries to pluginloader, to fix problems with non-filesystem errors being masked by the second load_code call
Diffstat (limited to 'util/pluginloader.lua')
-rw-r--r--util/pluginloader.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/util/pluginloader.lua b/util/pluginloader.lua
index 0d7eafa7..004855f0 100644
--- a/util/pluginloader.lua
+++ b/util/pluginloader.lua
@@ -55,8 +55,23 @@ local function load_code(plugin, resource, env)
return f, path;
end
+local function load_code_ext(plugin, resource, extension, env)
+ local content, err = load_resource(plugin, resource.."."..extension);
+ if not content then
+ content, err = load_resource(resource, resource.."."..extension);
+ if not content then
+ return content, err;
+ end
+ end
+ local path = err;
+ local f, err = envload(content, "@"..path, env);
+ if not f then return f, err; end
+ return f, path;
+end
+
return {
load_file = load_file;
load_resource = load_resource;
load_code = load_code;
+ load_code_ext = load_code_ext;
};