util.startupt: I'm now using the resolve_relative_path function from util/paths at the setup_plugindir function
authorJoão Duarte <jvsDuarte08@gmail.com>
Thu, 01 Aug 2019 04:33:05 -0700
changeset 10196 761ff113c741
parent 10195 395ce57dccdf
child 10197 9cad58759b3e
util.startupt: I'm now using the resolve_relative_path function from util/paths at the setup_plugindir function
util/startup.lua
--- 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);