226 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; |
226 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; |
227 end |
227 end |
228 |
228 |
229 function startup.setup_plugindir() |
229 function startup.setup_plugindir() |
230 local custom_plugin_paths = config.get("*", "plugin_paths"); |
230 local custom_plugin_paths = config.get("*", "plugin_paths"); |
|
231 local path_sep = package.config:sub(3,3); |
|
232 if custom_plugin_paths then |
|
233 -- path1;path2;path3;defaultpath... |
|
234 -- luacheck: ignore 111 |
|
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 end |
|
239 |
|
240 function startup.setup_plugin_install_path() |
231 local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins"; |
241 local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins"; |
232 local path_sep = package.config:sub(3,3); |
242 local path_sep = package.config:sub(3,3); |
233 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path); |
243 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path); |
234 require "lfs".mkdir(installer_plugin_path); |
244 require "lfs".mkdir(installer_plugin_path); |
235 require"util.paths".complement_lua_path(installer_plugin_path); |
245 require"util.paths".complement_lua_path(installer_plugin_path); |
236 if custom_plugin_paths then |
246 -- luacheck: ignore 111 |
237 -- path1;path2;path3;defaultpath... |
|
238 -- luacheck: ignore 111 |
|
239 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); |
|
240 prosody.paths.plugins = CFG_PLUGINDIR; |
|
241 end |
|
242 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); |
247 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); |
243 prosody.paths.plugins = CFG_PLUGINDIR; |
248 prosody.paths.plugins = CFG_PLUGINDIR; |
244 end |
249 end |
245 |
250 |
246 function startup.chdir() |
251 function startup.chdir() |
532 startup.init_global_state(); |
537 startup.init_global_state(); |
533 startup.read_config(); |
538 startup.read_config(); |
534 startup.force_console_logging(); |
539 startup.force_console_logging(); |
535 startup.init_logging(); |
540 startup.init_logging(); |
536 startup.setup_plugindir(); |
541 startup.setup_plugindir(); |
|
542 startup.setup_plugin_install_path(); |
537 startup.setup_datadir(); |
543 startup.setup_datadir(); |
538 startup.chdir(); |
544 startup.chdir(); |
539 startup.read_version(); |
545 startup.read_version(); |
540 startup.switch_user(); |
546 startup.switch_user(); |
541 startup.check_dependencies(); |
547 startup.check_dependencies(); |
557 startup.set_function_metatable(); |
563 startup.set_function_metatable(); |
558 startup.check_dependencies(); |
564 startup.check_dependencies(); |
559 startup.init_logging(); |
565 startup.init_logging(); |
560 startup.load_libraries(); |
566 startup.load_libraries(); |
561 startup.setup_plugindir(); |
567 startup.setup_plugindir(); |
|
568 startup.setup_plugin_install_path(); |
562 startup.setup_datadir(); |
569 startup.setup_datadir(); |
563 startup.chdir(); |
570 startup.chdir(); |
564 startup.add_global_prosody_functions(); |
571 startup.add_global_prosody_functions(); |
565 startup.read_version(); |
572 startup.read_version(); |
566 startup.log_greeting(); |
573 startup.log_greeting(); |