diff options
author | Jo?o Duarte <jvsDuarte08@gmail.com> | 2019-07-26 08:39:27 -0700 |
---|---|---|
committer | Jo?o Duarte <jvsDuarte08@gmail.com> | 2019-07-26 08:39:27 -0700 |
commit | b29dab1c1c6185c310c6346910aa7e0c8ed72596 (patch) | |
tree | 8426d36ed9b5c8e2747971b383e643d341ef923b /util/startup.lua | |
parent | ec4a8200cd9374b17d823ecf947b705d94b67952 (diff) | |
download | prosody-b29dab1c1c6185c310c6346910aa7e0c8ed72596.tar.gz prosody-b29dab1c1c6185c310c6346910aa7e0c8ed72596.zip |
util.startup: The .setup_plugindir function now correctly sets a default/specified path for custom plugins
Diffstat (limited to 'util/startup.lua')
-rw-r--r-- | util/startup.lua | 26 |
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 |