]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface.cxx
index 1d883736b1af1fffdf9350921c756e500626586a..9a2f7094a89184f0da5cd395fad695347c49c149 100644 (file)
@@ -28,6 +28,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 +59,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 +172,8 @@ LoadPluginDir( const std::string& dirname )
           );
         count++;
       }
-      catch( ... )
-      {
-        // Ignore errors
-      } // yrt
+      catch( ... ) { }
+
     } // elihw
     closedir( dir );
   }