aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorJoão Duarte <jvsDuarte08@gmail.com>2019-07-26 08:39:27 -0700
committerJoão Duarte <jvsDuarte08@gmail.com>2019-07-26 08:39:27 -0700
commit63071336691c272dded2c1b7d74e58d78a6ae8ca (patch)
tree8426d36ed9b5c8e2747971b383e643d341ef923b /util
parent449256fa0c00cce042fe8dc1a2b18bcbc0c07258 (diff)
downloadprosody-63071336691c272dded2c1b7d74e58d78a6ae8ca.tar.gz
prosody-63071336691c272dded2c1b7d74e58d78a6ae8ca.zip
util.startup: The .setup_plugindir function now correctly sets a default/specified path for custom plugins
Diffstat (limited to 'util')
-rw-r--r--util/startup.lua26
1 files changed, 16 insertions, 10 deletions
diff --git a/util/startup.lua b/util/startup.lua
index 54b968f8..363d8465 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -226,23 +226,29 @@ function startup.setup_datadir()
end
function startup.setup_plugindir()
+ --require "lfs".currentdir()
+ --local current_directory = lfs.currentdir()
local custom_plugin_paths = config.get("*", "plugin_paths");
- local installer_plugin_paths = config.get("*", "installer_plugin_paths") or {"custom_plugins"};
+ local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins";
+ local path_sep = package.config:sub(3,3);
if custom_plugin_paths then
- local path_sep = package.config:sub(3,3);
-- path1;path2;path3;defaultpath...
-- luacheck: ignore 111
CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
prosody.paths.plugins = CFG_PLUGINDIR;
end
- for path, _ in ipairs(installer_plugin_paths) do
- if os.execute('[ -d "'..installer_plugin_paths[path]..'" ]') ~= 0 then
- os.execute("mkdir "..installer_plugin_paths[path])
- end
- end
- local path_sep = package.config:sub(3,3);
- -- luacheck: ignore 111
- CFG_PLUGINDIR = table.concat(installer_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
+ -- Checking if the folder exists. If it doesn't, we create it
+ --[[if os.execute('[ -d "'..installer_plugin_path..'" ]') ~= 0 then
+ os.execute("mkdir "..installer_plugin_path)
+ end]]
+ --[[if not string.find(package.path, current_directory..installer_plugin_path[path]) then
+ --os.execute("ls -la "..current_directory..path_sep..installer_plugin_paths[path])
+ package.path = package.path..path_sep..current_directory..installer_plugin_path.."/?.lua"..path_sep..path_sep
+ package.path = package.path..current_directory..installer_plugin_path.."/?/init.lua"..path_sep..path_sep
+ package.cpath = package.cpath..path_sep..current_directory..installer_plugin_path.."/?.lua"
+ package.cpath = package.cpath..path_sep..current_directory..installer_plugin_path.."/?/init.lua"
+ end]]
+ CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins");
prosody.paths.plugins = CFG_PLUGINDIR;
end