Allow Engine::loadPluginDir(), Engine::extraPath() and yate -x to load a single module file, not an entire directory.

git-svn-id: http://voip.null.ro/svn/yate@4211 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-03-24 13:56:10 +00:00
parent f813c3a37a
commit 164211949e
2 changed files with 13 additions and 2 deletions

View File

@ -1310,6 +1310,17 @@ bool Engine::loadPluginDir(const String& relPath)
path += PATH_SEP;
path += relPath;
}
if (path.endsWith(s_modsuffix)) {
int sep = path.rfind(PATH_SEP[0]);
if (sep >= 0)
sep++;
else
sep = 0;
String name = path.substr(sep);
if (loadPlugin(path,s_cfg.getBoolValue("localsym",name,s_localsymbol),
s_cfg.getBoolValue("nounload",name)))
return true;
}
if (path.endsWith(PATH_SEP))
path = path.substr(0,path.length()-1);
#ifdef _WINDOWS

View File

@ -1122,9 +1122,9 @@ public:
{ return m_dispatcher.handlerCount(); }
/**
* Loads the plugins from an extra plugins directory
* Loads the plugins from an extra plugins directory or just an extra plugin
* @param relPath Path to the extra directory, relative to the main modules
* @return True if the directory could at least be opened
* @return True if the plugin was loaded or the directory could at least be opened
*/
bool loadPluginDir(const String& relPath);