Comparison

util/startup.lua @ 10201:2457b6b1908b

util.startup: Reorganized code at setup_plugindir
author João Duarte <jvsDuarte08@gmail.com>
date Thu, 01 Aug 2019 09:29:40 -0700
parent 10199:72afd4ed8ac9
child 10203:3beb37ed7f32
comparison
equal deleted inserted replaced
10200:48ee50ed9972 10201:2457b6b1908b
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_path = config.get("*", "installer_plugin_path") or "custom_plugins"; 230 local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins";
231 local path_sep = package.config:sub(3,3); 231 local path_sep = package.config:sub(3,3);
232 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path);
233 require "lfs".mkdir(installer_plugin_path);
234 config.complement_lua_path(installer_plugin_path);
232 if custom_plugin_paths then 235 if custom_plugin_paths then
233 -- path1;path2;path3;defaultpath... 236 -- path1;path2;path3;defaultpath...
234 -- luacheck: ignore 111 237 -- luacheck: ignore 111
235 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); 238 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
236 prosody.paths.plugins = CFG_PLUGINDIR; 239 prosody.paths.plugins = CFG_PLUGINDIR;
237 end 240 end
238 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path);
239 require "lfs".mkdir(installer_plugin_path);
240 config.complement_lua_path(installer_plugin_path);
241 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); 241 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins");
242 prosody.paths.plugins = CFG_PLUGINDIR; 242 prosody.paths.plugins = CFG_PLUGINDIR;
243 end 243 end
244 244
245 function startup.chdir() 245 function startup.chdir()