Mercurial > prosody-hg
comparison util/pluginloader.lua @ 7115:805d068d2fd5
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
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 01 Feb 2016 21:26:15 +0000 |
| parents | 5de6b93d0190 |
| children | e5d00bf4a4d5 |
comparison
equal
deleted
inserted
replaced
| 7114:51cf09bb74eb | 7115:805d068d2fd5 |
|---|---|
| 53 local f, err = envload(content, "@"..path, env); | 53 local f, err = envload(content, "@"..path, env); |
| 54 if not f then return f, err; end | 54 if not f then return f, err; end |
| 55 return f, path; | 55 return f, path; |
| 56 end | 56 end |
| 57 | 57 |
| 58 local function load_code_ext(plugin, resource, extension, env) | |
| 59 local content, err = load_resource(plugin, resource.."."..extension); | |
| 60 if not content then | |
| 61 content, err = load_resource(resource, resource.."."..extension); | |
| 62 if not content then | |
| 63 return content, err; | |
| 64 end | |
| 65 end | |
| 66 local path = err; | |
| 67 local f, err = envload(content, "@"..path, env); | |
| 68 if not f then return f, err; end | |
| 69 return f, path; | |
| 70 end | |
| 71 | |
| 58 return { | 72 return { |
| 59 load_file = load_file; | 73 load_file = load_file; |
| 60 load_resource = load_resource; | 74 load_resource = load_resource; |
| 61 load_code = load_code; | 75 load_code = load_code; |
| 76 load_code_ext = load_code_ext; | |
| 62 }; | 77 }; |
