diff options
author | Zdenek Prikryl <zprikryl@redhat.com> | 2009-03-17 11:22:26 +0100 |
---|---|---|
committer | Zdenek Prikryl <zprikryl@redhat.com> | 2009-03-17 11:22:26 +0100 |
commit | cb2573906c7d3a80f672ff125f19c0cbce885156 (patch) | |
tree | f9ac42f7fe23b43cbc4d7c2fc104c8ec6c94d0c0 /lib | |
parent | e7c8e56b84bf36f2cdc607b032c2c6d8caa88920 (diff) | |
download | abrt-cb2573906c7d3a80f672ff125f19c0cbce885156.tar.gz abrt-cb2573906c7d3a80f672ff125f19c0cbce885156.tar.xz abrt-cb2573906c7d3a80f672ff125f19c0cbce885156.zip |
Plugin's configuration file is optional
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MiddleWare/Plugin.h | 3 | ||||
-rw-r--r-- | lib/MiddleWare/PluginManager.cpp | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/MiddleWare/Plugin.h b/lib/MiddleWare/Plugin.h index 210e94d8..014733d8 100644 --- a/lib/MiddleWare/Plugin.h +++ b/lib/MiddleWare/Plugin.h @@ -30,7 +30,8 @@ #define PLUGINS_MAGIC_NUMBER 1 #define PLUGINS_CONF_EXTENSION "conf" -#define PLUGINS_LIB_EXTENSIONS "so" +#define PLUGINS_LIB_EXTENSION "so" +#define PLUGINS_LIB_PREFIX "lib" class CPlugin { diff --git a/lib/MiddleWare/PluginManager.cpp b/lib/MiddleWare/PluginManager.cpp index 7d8eb4ef..e0def74a 100644 --- a/lib/MiddleWare/PluginManager.cpp +++ b/lib/MiddleWare/PluginManager.cpp @@ -37,7 +37,7 @@ CPluginManager::~CPluginManager() void CPluginManager::LoadPlugins() { - DIR *dir = opendir(m_sPlugisConfDir.c_str()); + DIR *dir = opendir(m_sPlugisLibDir.c_str()); struct dirent *dent = NULL; if (dir != NULL) { @@ -46,10 +46,11 @@ void CPluginManager::LoadPlugins() if (dent->d_type == DT_REG) { std::string name = dent->d_name; - std::string extension = name.substr(name.length()-sizeof(PLUGINS_CONF_EXTENSION)+1); - if (extension == PLUGINS_CONF_EXTENSION) + std::string extension = name.substr(name.length()-sizeof(PLUGINS_LIB_EXTENSION)+1); + if (extension == PLUGINS_LIB_EXTENSION) { - name.erase(name.length()-sizeof(PLUGINS_CONF_EXTENSION)); + name.erase(0, sizeof(PLUGINS_LIB_PREFIX) - 1); + name.erase(name.length() - sizeof(PLUGINS_LIB_EXTENSION)); LoadPlugin(name); } } @@ -75,7 +76,7 @@ void CPluginManager::LoadPlugin(const std::string& pName) CABRTPlugin* abrtPlugin = NULL; try { - std::string libPath = m_sPlugisLibDir + "/lib" + pName + "." + PLUGINS_LIB_EXTENSIONS; + std::string libPath = m_sPlugisLibDir + "/" + PLUGINS_LIB_PREFIX + pName + "." + PLUGINS_LIB_EXTENSION; abrtPlugin = new CABRTPlugin(libPath); if (abrtPlugin->GetMagicNumber() != PLUGINS_MAGIC_NUMBER || (abrtPlugin->GetType() < LANGUAGE && abrtPlugin->GetType() > DATABASE)) |