Software /
code /
prosody
Comparison
util/startup.lua @ 10174:55dc8eb1e7d3
util.startup: .setup_plugindir now checks if the specified directory for custom plugins exists, and creates it if it doesn't
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Fri, 26 Jul 2019 08:58:56 -0700 |
parent | 10173:0513dd2830b7 |
child | 10175:4dac771ddf9f |
comparison
equal
deleted
inserted
replaced
10173:0513dd2830b7 | 10174:55dc8eb1e7d3 |
---|---|
224 function startup.setup_datadir() | 224 function startup.setup_datadir() |
225 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; | 225 prosody.paths.data = config.get("*", "data_path") or CFG_DATADIR or "data"; |
226 end | 226 end |
227 | 227 |
228 function startup.setup_plugindir() | 228 function startup.setup_plugindir() |
229 --require "lfs".currentdir() | 229 --local lfs_currentdir = require "lfs".currentdir() |
230 --local current_directory = lfs.currentdir() | 230 --local current_directory = lfs_currentdir |
231 local custom_plugin_paths = config.get("*", "plugin_paths"); | 231 local custom_plugin_paths = config.get("*", "plugin_paths"); |
232 local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins"; | 232 local installer_plugin_path = config.get("*", "installer_plugin_path") or "custom_plugins"; |
233 local path_sep = package.config:sub(3,3); | 233 local path_sep = package.config:sub(3,3); |
234 if custom_plugin_paths then | 234 if custom_plugin_paths then |
235 -- path1;path2;path3;defaultpath... | 235 -- path1;path2;path3;defaultpath... |
236 -- luacheck: ignore 111 | 236 -- luacheck: ignore 111 |
237 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); | 237 CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins"); |
238 prosody.paths.plugins = CFG_PLUGINDIR; | 238 prosody.paths.plugins = CFG_PLUGINDIR; |
239 end | 239 end |
240 -- Checking if the folder exists. If it doesn't, we create it | 240 -- Checking if the folder exists. If it doesn't, we create it |
241 --[[if os.execute('[ -d "'..installer_plugin_path..'" ]') ~= 0 then | 241 if os.execute('[ -d "'..installer_plugin_path..'" ]') ~= 0 then |
242 os.execute("mkdir "..installer_plugin_path) | 242 os.execute("mkdir "..installer_plugin_path) |
243 end]] | 243 end |
244 --[[if not string.find(package.path, current_directory..installer_plugin_path[path]) then | 244 --[[if not string.find(package.path, current_directory..installer_plugin_path[path]) then |
245 --os.execute("ls -la "..current_directory..path_sep..installer_plugin_paths[path]) | 245 --os.execute("ls -la "..current_directory..path_sep..installer_plugin_paths[path]) |
246 package.path = package.path..path_sep..current_directory..installer_plugin_path.."/?.lua"..path_sep..path_sep | 246 package.path = package.path..path_sep..current_directory..installer_plugin_path.."/?.lua"..path_sep..path_sep |
247 package.path = package.path..current_directory..installer_plugin_path.."/?/init.lua"..path_sep..path_sep | 247 package.path = package.path..current_directory..installer_plugin_path.."/?/init.lua"..path_sep..path_sep |
248 package.cpath = package.cpath..path_sep..current_directory..installer_plugin_path.."/?.lua" | 248 package.cpath = package.cpath..path_sep..current_directory..installer_plugin_path.."/?.lua" |