Changeset

10404:29c10930a7b2

util.startup: Split plugin installer path setup into a separate function
author Kim Alvefur <zash@zash.se>
date Sat, 09 Nov 2019 00:23:08 +0100
parents 10403:3b82e9df5a7a
children 10405:e7f5735f19e1
files util/startup.lua
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/util/startup.lua	Fri Nov 08 23:03:47 2019 +0100
+++ b/util/startup.lua	Sat Nov 09 00:23:08 2019 +0100
@@ -228,17 +228,22 @@
 
 function startup.setup_plugindir()
 	local custom_plugin_paths = config.get("*", "plugin_paths");
-	local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins";
 	local path_sep = package.config:sub(3,3);
-	installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path);
-	require "lfs".mkdir(installer_plugin_path);
-	require"util.paths".complement_lua_path(installer_plugin_path);
 	if custom_plugin_paths then
 		-- path1;path2;path3;defaultpath...
 		-- luacheck: ignore 111
 		CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
 		prosody.paths.plugins = CFG_PLUGINDIR;
 	end
+end
+
+function startup.setup_plugin_install_path()
+	local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins";
+	local path_sep = package.config:sub(3,3);
+	installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path);
+	require "lfs".mkdir(installer_plugin_path);
+	require"util.paths".complement_lua_path(installer_plugin_path);
+	-- luacheck: ignore 111
 	CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins");
 	prosody.paths.plugins = CFG_PLUGINDIR;
 end
@@ -534,6 +539,7 @@
 	startup.force_console_logging();
 	startup.init_logging();
 	startup.setup_plugindir();
+	startup.setup_plugin_install_path();
 	startup.setup_datadir();
 	startup.chdir();
 	startup.read_version();
@@ -559,6 +565,7 @@
 	startup.init_logging();
 	startup.load_libraries();
 	startup.setup_plugindir();
+	startup.setup_plugin_install_path();
 	startup.setup_datadir();
 	startup.chdir();
 	startup.add_global_prosody_functions();