From 9cf24d5024f39cc54a39d220879d4c62d4a4b34c Mon Sep 17 00:00:00 2001
From: Jo?o Duarte <jvsDuarte08@gmail.com>
Date: Thu, 1 Aug 2019 04:33:05 -0700
Subject: util.startupt: I'm now using the resolve_relative_path function from
 util/paths at the setup_plugindir function

---
 util/startup.lua | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

(limited to 'util')

diff --git a/util/startup.lua b/util/startup.lua
index 4601bd85..4b3842bb 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -238,16 +238,8 @@ function startup.setup_plugindir()
 		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);
-- 
cgit v1.2.3