diff options
author | João Duarte <jvsDuarte08@gmail.com> | 2019-07-24 10:37:01 -0700 |
---|---|---|
committer | João Duarte <jvsDuarte08@gmail.com> | 2019-07-24 10:37:01 -0700 |
commit | 20f233099eaf3122df6acc163bcd119f6b877c89 (patch) | |
tree | b48af6c8c7e78964768e80cacc5acd895c35185d | |
parent | 46ae143d9a6a51b72365b8d2781e7d45d8e332c7 (diff) | |
download | prosody-20f233099eaf3122df6acc163bcd119f6b877c89.tar.gz prosody-20f233099eaf3122df6acc163bcd119f6b877c89.zip |
util.startup: Now it also loads default or configured paths to custom plugin directories and creates them
-rw-r--r-- | util/startup.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/util/startup.lua b/util/startup.lua index 7a1a95aa..65a131fe 100644 --- a/util/startup.lua +++ b/util/startup.lua @@ -227,6 +227,7 @@ end function startup.setup_plugindir() local custom_plugin_paths = config.get("*", "plugin_paths"); + local installer_plugin_paths = config.get("*", "installer_plugin_paths") or {"custom_plugins"}; if custom_plugin_paths then local path_sep = package.config:sub(3,3); -- path1;path2;path3;defaultpath... @@ -234,6 +235,17 @@ 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 + if installer_plugin_paths then + 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"); + prosody.paths.plugins = CFG_PLUGINDIR; + end end function startup.chdir() |