]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface.cxx
index 6ffc0fe462ae5b033b3cf64f7fe1ba900b27399f..f7ec07ef276bb08619f60286e00c67878484b863 100644 (file)
@@ -6,7 +6,7 @@
 #  include <dlfcn.h>
 #endif // cpPlugins_SYS_WINDOWS
 #include <cpPlugins_dirent.h>
-#include <cpPlugins/cpPlugins_DynLibs.h>
+#include <cpPlugins_Instances/cpPlugins_DynLibs.h>
 #include <algorithm>
 
 // -------------------------------------------------------------------------
@@ -21,10 +21,29 @@ Interface( )
   // Explicitly load all ITK and VTK
   if( Self::InterfacesCount == 0 )
   {
+    // Base libraries
     std::vector< std::string > libs;
     cpPlugins::TokenizeString( libs, cpPlugins_DynLibs, ";" );
-    this->_AddInstancesLib( libs, cpPlugins_CompilationDir );
-    this->_AddInstancesLib( libs, cpPlugins_InstallationDir );
+
+    // Local instances
+    for( auto p = this->m_Paths.begin( ); p != this->m_Paths.end( ); ++p )
+    {
+      DIR* dir;
+      struct dirent* ent;
+      if( ( dir = opendir( p->c_str( ) ) ) != NULL )
+      {
+        while( ( ent = readdir( dir ) ) != NULL )
+        {
+          std::string fname = *p + std::string( "/" ) + ent->d_name;
+          if( fname.find( "_Instances" ) != std::string::npos )
+            libs.push_back( fname );
+
+        } // elihw
+        closedir( dir );
+
+      } // fi
+
+    } // rof
 
     for( auto l = libs.begin( ); l != libs.end( ); ++l )
     {
@@ -301,27 +320,6 @@ GetPlugins( ) const
   return( res );
 }
 
-// -------------------------------------------------------------------------
-template< class _TList >
-void cpPlugins::Interface::
-_AddInstancesLib( _TList& libs, const std::string& path )
-{
-  DIR* dir;
-  struct dirent* ent;
-  if( ( dir = opendir( path.c_str( ) ) ) != NULL )
-  {
-    while( ( ent = readdir( dir ) ) != NULL )
-    {
-      std::string fname = path + std::string( "/" ) + ent->d_name;
-      if( fname.find( "cpPlugins_Instances_" ) != std::string::npos )
-        libs.push_back( fname );
-
-    } // elihw
-    closedir( dir );
-
-  } // fi
-}
-
 // -------------------------------------------------------------------------
 void* cpPlugins::Interface::
 _DLOpen( const std::string& fname, std::string& error )