Software /
code /
prosody
Comparison
util/startup.lua @ 10163:661feb336e18
util.startup: Now it also loads default or configured paths to custom plugin directories and creates them
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Wed, 24 Jul 2019 10:37:01 -0700 |
parent | 9878:dd61201fc5af |
child | 10171:628e238feb04 |
comparison
equal
deleted
inserted
replaced
10162:7a4c15f75deb | 10163:661feb336e18 |
---|---|
225 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; | 225 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; |
226 end | 226 end |
227 | 227 |
228 function startup.setup_plugindir() | 228 function startup.setup_plugindir() |
229 local custom_plugin_paths = config.get("*", "plugin_paths"); | 229 local custom_plugin_paths = config.get("*", "plugin_paths"); |
230 local installer_plugin_paths = config.get("*", "installer_plugin_paths") or {"custom_plugins"}; | |
230 if custom_plugin_paths then | 231 if custom_plugin_paths then |
231 local path_sep = package.config:sub(3,3); | 232 local path_sep = package.config:sub(3,3); |
232 -- path1;path2;path3;defaultpath... | 233 -- path1;path2;path3;defaultpath... |
233 -- luacheck: ignore 111 | 234 -- luacheck: ignore 111 |
234 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); | 235 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); |
236 prosody.paths.plugins = CFG_PLUGINDIR; | |
237 end | |
238 if installer_plugin_paths then | |
239 for path, _ in ipairs(installer_plugin_paths) do | |
240 if os.execute('[ -d "'..installer_plugin_paths[path]..'" ]') ~= 0 then | |
241 os.execute("mkdir "..installer_plugin_paths[path]) | |
242 end | |
243 end | |
244 local path_sep = package.config:sub(3,3); | |
245 -- luacheck: ignore 111 | |
246 CFG_PLUGINDIR = table.concat(installer_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); | |
235 prosody.paths.plugins = CFG_PLUGINDIR; | 247 prosody.paths.plugins = CFG_PLUGINDIR; |
236 end | 248 end |
237 end | 249 end |
238 | 250 |
239 function startup.chdir() | 251 function startup.chdir() |