Comparison

util/startup.lua @ 11305:cd8516a77255

util.startup: Make installer_plugin_path relative to data directory Having it relative to current working directory is problematic since this depends on how Prosody was started and changes to the data directory during startup (but after this point).
author Kim Alvefur <zash@zash.se>
date Sun, 24 Jan 2021 16:12:53 +0100
parent 11304:c022b582d312
child 11560:3bbb1af92514
comparison
equal deleted inserted replaced
11304:c022b582d312 11305:cd8516a77255
265 prosody.paths.plugins = CFG_PLUGINDIR; 265 prosody.paths.plugins = CFG_PLUGINDIR;
266 end 266 end
267 end 267 end
268 268
269 function startup.setup_plugin_install_path() 269 function startup.setup_plugin_install_path()
270 local installer_plugin_path = config.get("*", "installer_plugin_path") or (CFG_DATADIR or "data").."/custom_plugins"; 270 local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins";
271 local path_sep = package.config:sub(3,3); 271 local path_sep = package.config:sub(3,3);
272 -- TODO Figure out what this should be relative to, because CWD could be anywhere 272 installer_plugin_path = config.resolve_relative_path(CFG_DATADIR or "data", installer_plugin_path);
273 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path);
274 require"util.paths".complement_lua_path(installer_plugin_path); 273 require"util.paths".complement_lua_path(installer_plugin_path);
275 -- luacheck: ignore 111 274 -- luacheck: ignore 111
276 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); 275 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins");
277 prosody.paths.installer = installer_plugin_path; 276 prosody.paths.installer = installer_plugin_path;
278 prosody.paths.plugins = CFG_PLUGINDIR; 277 prosody.paths.plugins = CFG_PLUGINDIR;