X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface.cxx;h=53b7b118174179807139737986a54f5e9a1ed93b;hb=00d030e4e10fea579b427297027e3ac37ff960b6;hp=1d883736b1af1fffdf9350921c756e500626586a;hpb=b445d953049ba15290197549dcd4e31367e3c8a5;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface.cxx b/lib/cpPlugins/Interface.cxx index 1d88373..53b7b11 100644 --- a/lib/cpPlugins/Interface.cxx +++ b/lib/cpPlugins/Interface.cxx @@ -6,6 +6,7 @@ # include #endif // cpPlugins_SYS_WINDOWS #include +#include // ------------------------------------------------------------------------- cpPlugins::Interface:: @@ -28,6 +29,26 @@ GetFilters( ) return( this->m_Filters ); } +// ------------------------------------------------------------------------- +void cpPlugins::Interface:: +GuessAccesiblePlugins( ) +{ + // Load environment configuration + char* path = std::getenv( "cpPlugins_PATHS" ); + if( path != NULL ) + { + std::vector< std::string > tokens; + cpPlugins::TokenizeString( tokens, path, "#" ); + for( auto tIt = tokens.begin( ); tIt != tokens.end( ); ++tIt ) + try { this->LoadPluginDir( *tIt ); } catch( ... ) { } + + } // fi + + // Load local path + auto lpath = cpPlugins::CanonicalPath( "." ); + try { this->LoadPluginDir( lpath ); } catch( ... ) { } +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface:: LoadConfiguration( const std::string& filename ) @@ -39,18 +60,7 @@ LoadConfiguration( const std::string& filename ) this->UnloadAll( ); std::string line; while( std::getline( in, line ) ) - { - try - { - this->LoadPluginFile( line ); - } - catch( ... ) - { - // Do nothing - - } // yrt - - } // elihw + try { this->LoadPluginFile( line ); } catch( ... ) { } return( true ); } @@ -163,10 +173,8 @@ LoadPluginDir( const std::string& dirname ) ); count++; } - catch( ... ) - { - // Ignore errors - } // yrt + catch( ... ) { } + } // elihw closedir( dir ); }