util/startup.lua
changeset 10196 761ff113c741
parent 10179 4dac771ddf9f
child 10197 9cad58759b3e
equal deleted inserted replaced
10195:395ce57dccdf 10196:761ff113c741
   236 		-- path1;path2;path3;defaultpath...
   236 		-- path1;path2;path3;defaultpath...
   237 		-- luacheck: ignore 111
   237 		-- luacheck: ignore 111
   238 		CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
   238 		CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
   239 		prosody.paths.plugins = CFG_PLUGINDIR;
   239 		prosody.paths.plugins = CFG_PLUGINDIR;
   240 	end
   240 	end
   241 	-- Checks if installer_plugin_path is a relative paths and makes it an absolute path
   241 	local current_directory = require "lfs".currentdir();
   242 	if installer_plugin_path:sub(1,1) ~= "/" then
   242 	installer_plugin_path = config.resolve_relative_path(current_directory, installer_plugin_path);
   243 		-- Works fine when executing prosody from source (configure and make only)
       
   244 		-- Probably wont be the best install directory, when using a package installation
       
   245 		local lfs_currentdir = require "lfs".currentdir();
       
   246 		local current_directory = lfs_currentdir;
       
   247 		-- Some normalization
       
   248 		installer_plugin_path = installer_plugin_path:gsub("^%.%"..dir_sep.."+", "");
       
   249 		installer_plugin_path = current_directory..dir_sep..installer_plugin_path;
       
   250 	end
       
   251 	-- Checking if the folder exists. If it doesn't, we create it, but we need permissions to do so
   243 	-- Checking if the folder exists. If it doesn't, we create it, but we need permissions to do so
   252 	if os.execute('[ -d "'..installer_plugin_path..'" ]') ~= 0 then
   244 	if os.execute('[ -d "'..installer_plugin_path..'" ]') ~= 0 then
   253 		os.execute("mkdir "..installer_plugin_path);
   245 		os.execute("mkdir "..installer_plugin_path);
   254 	end
   246 	end
   255 	-- Developers may have add these custom paths to their LUA_PATH/LUA_CPATH variables, before running prosody
   247 	-- Developers may have add these custom paths to their LUA_PATH/LUA_CPATH variables, before running prosody