Software /
code /
prosody
Comparison
util/startup.lua @ 10196:5e1012f2f2b7
util.startup: setup_plugindir now also checks package.cpath for duplicates
author | João Duarte <jvsDuarte08@gmail.com> |
---|---|
date | Thu, 01 Aug 2019 08:28:24 -0700 |
parent | 10195:3409f746f978 |
child | 10199:72afd4ed8ac9 |
comparison
equal
deleted
inserted
replaced
10195:3409f746f978 | 10196:5e1012f2f2b7 |
---|---|
238 end | 238 end |
239 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path); | 239 installer_plugin_path = config.resolve_relative_path(require "lfs".currentdir(), installer_plugin_path); |
240 require "lfs".mkdir(installer_plugin_path) | 240 require "lfs".mkdir(installer_plugin_path) |
241 -- Checking for duplicates | 241 -- Checking for duplicates |
242 -- The commands using luarocks need the path to the directory that has the /share and /lib folders. | 242 -- The commands using luarocks need the path to the directory that has the /share and /lib folders. |
243 local lua_version = _VERSION:match(" (.+)$") | |
244 local sub_path = dir_sep.."lua"..dir_sep..lua_version..dir_sep | |
243 if not string.match(package.path, installer_plugin_path) then | 245 if not string.match(package.path, installer_plugin_path) then |
244 local lua_version = _VERSION:match(" (.+)$") | |
245 local sub_path = dir_sep.."lua"..dir_sep..lua_version..dir_sep | |
246 package.path = package.path..path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?.lua"; | 246 package.path = package.path..path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?.lua"; |
247 package.path = package.path..path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?"..dir_sep.."init.lua"; | 247 package.path = package.path..path_sep..installer_plugin_path..dir_sep.."share"..sub_path.."?"..dir_sep.."init.lua"; |
248 end | |
249 if not string.match(package.path, installer_plugin_path) then | |
248 package.cpath = package.cpath..path_sep..installer_plugin_path..dir_sep.."lib"..sub_path.."?.lua"; | 250 package.cpath = package.cpath..path_sep..installer_plugin_path..dir_sep.."lib"..sub_path.."?.lua"; |
249 end | 251 end |
250 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); | 252 CFG_PLUGINDIR = installer_plugin_path..path_sep..(CFG_PLUGINDIR or "plugins"); |
251 prosody.paths.plugins = CFG_PLUGINDIR; | 253 prosody.paths.plugins = CFG_PLUGINDIR; |
252 end | 254 end |