Comparison

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
comparison
equal deleted inserted replaced
10191:395ce57dccdf 10192: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