From: stephan b. <sg...@us...> - 2004-12-25 01:09:08
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29665/include/pclasses/Plugin Modified Files: Plugin.h Log Message: Added findPlugin(), a no-throw way to check if a plugin dll exists before trying to addPlugin() it. Index: Plugin.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Plugin/Plugin.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Plugin.h 25 Dec 2004 00:07:30 -0000 1.3 +++ Plugin.h 25 Dec 2004 01:08:58 -0000 1.4 @@ -211,6 +211,12 @@ return this->m_holder.container(); } + std::string findPlugin( const std::string & name ) const + { + return this->searchPath().find( name ); + } + + private: // PluginManager( const ThisType & ); // not impl. // ThisType & operator=( const ThisType & ); // not impl. @@ -220,11 +226,7 @@ this->m_path.addPath( "." ); this->m_path.addPath( PCLASSES_PLUGINS_DIR ); this->m_path.addPath( PCLASSES_LIB_DIR ); -#ifdef __WIN32__ - this->m_path.addExtension( ".dll" ); -#else - this->m_path.addExtension( ".so" ); -#endif + this->m_path.addExtension(std::string(".")+std::string(PCLASSES_PLATFORM_SHARED_LIB_EXTENSION)); } PluginCleaner<PluginList> m_holder; ::P::System::PathFinder m_path; @@ -259,6 +261,12 @@ return pluginManager<T>().addPlugin( pluginname ); } + template <typename T> + std::string findPlugin( const std::string & name ) + { + return pluginManager<T>().findPlugin( name ); + } + } } // namespace P:: Plugin |