Diff

util/startup.lua @ 10192:761ff113c741

util.startupt: I'm now using the resolve_relative_path function from util/paths at the setup_plugindir function
author João Duarte <jvsDuarte08@gmail.com>
date Thu, 01 Aug 2019 04:33:05 -0700
parent 10175:4dac771ddf9f
child 10193:9cad58759b3e
line wrap: on
line diff
--- a/util/startup.lua	Thu Aug 01 04:16:00 2019 -0700
+++ b/util/startup.lua	Thu Aug 01 04:33:05 2019 -0700
@@ -238,16 +238,8 @@
 		CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
 		prosody.paths.plugins = CFG_PLUGINDIR;
 	end
-	-- Checks if installer_plugin_path is a relative paths and makes it an absolute path
-	if installer_plugin_path:sub(1,1) ~= "/" then
-		-- Works fine when executing prosody from source (configure and make only)
-		-- Probably wont be the best install directory, when using a package installation
-		local lfs_currentdir = require "lfs".currentdir();
-		local current_directory = lfs_currentdir;
-		-- Some normalization
-		installer_plugin_path = installer_plugin_path:gsub("^%.%"..dir_sep.."+", "");
-		installer_plugin_path = current_directory..dir_sep..installer_plugin_path;
-	end
+	local current_directory = require "lfs".currentdir();
+	installer_plugin_path = config.resolve_relative_path(current_directory, installer_plugin_path);
 	-- Checking if the folder exists. If it doesn't, we create it, but we need permissions to do so
 	if os.execute('[ -d "'..installer_plugin_path..'" ]') ~= 0 then
 		os.execute("mkdir "..installer_plugin_path);