From 164211949e565681861a22df91f644d48b447839 Mon Sep 17 00:00:00 2001 From: paulc Date: Thu, 24 Mar 2011 13:56:10 +0000 Subject: [PATCH] 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 --- engine/Engine.cpp | 11 +++++++++++ yatengine.h | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engine/Engine.cpp b/engine/Engine.cpp index e389aa9d..39d61f51 100644 --- a/engine/Engine.cpp +++ b/engine/Engine.cpp @@ -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 diff --git a/yatengine.h b/yatengine.h index ba86ddff..be3b924f 100644 --- a/yatengine.h +++ b/yatengine.h @@ -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);