]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Plugins.cxx
debug
[cpPlugins.git] / lib / cpPlugins / Interface / Plugins.cxx
index 4647fde50d1d25a2669b3aa32c05df49f1c91137..1543d314a25443d1ce8e7068b01bc990ea6d2099 100644 (file)
 #include <cpPlugins/Interface/Plugins.h>
+#include <cpPlugins/OS/DLLManager.h>
+#include <cpPlugins/OS/DirContents.h>
+#include <cpPlugins/Utility.h>
 
-#ifdef cpPlugins_Interface_QT4
-
-/*
-  #include <QApplication>
-  #include <QFileDialog>
-  #include <QMenu>
-  #include <QMessageBox>
-  #include <QWidget>
-*/
-
-#ifdef _WIN32
-#  define PLUGIN_PREFIX ""
-#  define PLUGIN_EXT "dll"
-#  define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
-#else // Linux
-#  define PLUGIN_PREFIX "lib"
-#  define PLUGIN_EXT "so"
-#  define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
-#endif // _WIN32
-
-#endif // cpPlugins_Interface_QT4
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Plugins::Pointer
+cpPlugins::Interface::Plugins::m_Singleton = NULL;
 
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Plugins::
-Plugins( )
-  : m_Widget( NULL ),
-    m_Application( NULL ),
-    m_Interface( NULL ),
-    m_LastLoadedPlugin( "" ),
-    m_ActiveFilter( NULL )
+Pointer cpPlugins::Interface::Plugins::
+New( )
 {
-  this->m_Interface = new TInterface( );
+  if( Self::m_Singleton.IsNull( ) )
+    Self::m_Singleton = new Self( );
+  return( Self::m_Singleton );
 }
 
 // -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-~Plugins( )
+itk::LightObject::Pointer cpPlugins::Interface::Plugins::
+CreateAnother( ) const
 {
-  if( this->m_Interface != NULL )
-    delete this->m_Interface;
+  itk::LightObject::Pointer smartPtr;
+  smartPtr = Self::m_Singleton;
+  return( smartPtr );
 }
 
 // -------------------------------------------------------------------------
-QWidget* cpPlugins::Interface::Plugins::
-GetWidget( )
+cpPlugins::Interface::Plugins::
+Pointer cpPlugins::Interface::Plugins::
+Clone( ) const
 {
-  return( this->m_Widget );
+  return( Self::m_Singleton );
 }
 
 // -------------------------------------------------------------------------
-const QWidget* cpPlugins::Interface::Plugins::
-GetWidget( ) const
+const cpPlugins::Interface::Plugins::
+TFilters& cpPlugins::Interface::Plugins::
+GetFilters( ) const
 {
-  return( this->m_Widget );
+  return( this->m_Filters );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-SetWidget( QWidget* widget )
+LoadPluginsFile( const std::string& libname )
 {
-  this->m_Widget = widget;
+  std::map< std::string, std::set< std::string > > filters;
+  cpPlugins::OS::DLLManager::GetPluginsLibraryContents( filters, libname );
+  THandlers zero( NULL, NULL );
+  for( auto i : filters )
+    for( auto j : i.second )
+      this->m_Filters[ i.first ][ j ] = TLibData( libname, zero );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-BlockWidget( )
+LoadPluginsDirectory( const std::string& dir )
 {
-#ifdef cpPlugins_Interface_QT4
-  if( this->m_Widget != NULL )
-  {
-    QApplication::setOverrideCursor( Qt::WaitCursor );
-    this->m_Widget->setEnabled( false );
+  // Create a globbing pattern
+  std::stringstream glob;
+  glob << cpPlugins_LIB_PREFIX << "*" << cpPlugins_LIB_EXT;
 
-  } // fi
-#endif // cpPlugins_Interface_QT4
+  // Get possible shared libraries
+  std::set< std::string > files =
+    cpPlugins::OS::LoadDirContents( dir, false, glob.str( ) );
+  this->m_PluginsPaths.insert( dir );
+  for( auto f : files )
+    try { this->LoadPluginsFile( f ); } catch( ... ) { }
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-UnblockWidget( )
+GuessPlugins( )
 {
-#ifdef cpPlugins_Interface_QT4
-  if( this->m_Widget != NULL )
+  // Create a globbing pattern
+  std::stringstream glob;
+  glob << cpPlugins_LIB_PREFIX << "*" << cpPlugins_LIB_EXT;
+
+  // Update paths and get possible shared libraries
+  this->_ReadPluginsPathsVariable( );
+  for( auto dir : this->m_PluginsPaths )
   {
-    QApplication::restoreOverrideCursor( );
-    this->m_Widget->setEnabled( true );
+    std::set< std::string > files =
+      cpPlugins::OS::LoadDirContents( dir, false, glob.str( ) );
+    for( auto f : files )
+      try { this->LoadPluginsFile( f ); } catch( ... ) { }
 
-  } // fi
-#endif // cpPlugins_Interface_QT4
+  } // rof
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-DialogLoadPlugins( )
+GuessEnvironment( const std::string& dir )
 {
-#ifdef cpPlugins_Interface_QT4
-  if( this->m_Widget != NULL )
+  std::stringstream fname;
+  fname << dir << cpPlugins_PATH_SEPARATOR << cpPlugins_PATHS;
+  std::string buffer;
+  if( cpPlugins::Read( buffer, fname.str( ) ) )
   {
-    QFileDialog dialog( this->m_Widget );
-    dialog.setFileMode( QFileDialog::ExistingFile );
-    dialog.setDirectory( this->m_LastLoadedPlugin.c_str( ) );
-    dialog.setNameFilter( QFileDialog::tr( PLUGIN_REGEX ) );
-    dialog.setDefaultSuffix( QFileDialog::tr( PLUGIN_EXT ) );
-    if( !( dialog.exec( ) ) )
-      return;
-
-    std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
-    if( !( this->LoadPlugins( fname ) ) )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Ignoring plugin" ),
-        QMessageBox::tr( fname.c_str( ) )
-        );
+    std::istringstream input( buffer );
+    for( std::string line; std::getline( input, line ); )
+      this->m_PluginsPaths.insert( cpPlugins::CanonicalPath( line ) );
 
   } // fi
-#endif // cpPlugins_Interface_QT4
-}
-
-// -------------------------------------------------------------------------
-BaseApplication* cpPlugins::Interface::Plugins::
-GetApplication( )
-{
-  return( this->m_Application );
-}
-
-// -------------------------------------------------------------------------
-const BaseApplication* cpPlugins::Interface::Plugins::
-GetApplication( ) const
-{
-  return( this->m_Application );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-SetApplication( BaseApplication* a )
-{
-  this->m_Application = a;
 }
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Plugins::
-LoadPlugins( )
+SaveEnvironment( const std::string& dir )
 {
-  // TODO: what to do here?
+  std::stringstream buffer;
+  for( auto p : this->m_PluginsPaths )
+    buffer << p << std::endl;
+  std::stringstream fname;
+  fname << dir << cpPlugins_PATH_SEPARATOR << cpPlugins_PATHS;
+  return( cpPlugins::Write( buffer.str( ), fname.str( ) ) );
 }
 
 // -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-LoadPlugins( const std::string& fname )
-{
-  this->BlockWidget( );
-
-  // Is it already loaded?
-  bool ret = true;
-  if( this->m_LoadedPlugins.find( fname ) == this->m_LoadedPlugins.end( ) )
-  {
-    // Was it succesfully loaded?
-    ret = this->m_Interface->Load( fname );
-
-    // Update a simple track
-    if( ret )
+cpPlugins::BaseObjects::ProcessObject::Pointer
+cpPlugins::Interface::Plugins::
+CreateFilter( const std::string& category, const std::string& name )
+{
+  std::cout << "1" << std::endl;
+  typedef void* ( *_TCreator )( );
+  std::cout << "2" << std::endl;
+  typedef cpPlugins::BaseObjects::ProcessObject::Pointer _TPtr;
+  std::cout << "3" << std::endl;
+  _TPtr o = NULL;
+  std::cout << "4" << std::endl;
+  auto cat = this->m_Filters.find( category );
+  std::cout << "5" << std::endl;
+  if( cat != this->m_Filters.end( ) )
+  {
+  std::cout << "6" << std::endl;
+    auto nam = cat->second.find( name );
+  std::cout << "7" << std::endl;
+    if( nam != cat->second.end( ) )
     {
-      this->m_LoadedPlugins.insert( fname );
-      this->m_LastLoadedPlugin = fname;
-      this->_UpdateLoadedPluginsInformation( );
+  std::cout << "8" << std::endl;
+      void* l_hnd = nam->second.second.first;
+  std::cout << "9" << std::endl;
+      void* f_hnd = nam->second.second.second;
+  std::cout << "10" << std::endl;
+      if( l_hnd == NULL )
+      {
+  std::cout << "11" << std::endl;
+        l_hnd = cpPlugins::OS::DLLManager::LoadPlugins( nam->second.first );
+  std::cout << "12" << std::endl;
+        nam->second.second.first = l_hnd;
+  std::cout << "13" << std::endl;
+
+      } // fi
+      if( f_hnd == NULL )
+      {
+  std::cout << "14" << std::endl;
+        f_hnd =
+          cpPlugins::OS::DLLManager::LoadCreator( l_hnd, category, name );
+  std::cout << "15" << std::endl;
+        nam->second.second.second = f_hnd;
+  std::cout << "16" << std::endl;
+
+      } // fi
+  std::cout << "17" << std::endl;
+      _TCreator creator = reinterpret_cast< _TCreator >( f_hnd );
+  std::cout << "18" << std::endl;
+      if( creator != NULL )
+      {
+        std::cout << "19 " << creator << " " << f_hnd << std::endl;
+        void* a = creator( );
+  std::cout << "20" << std::endl;
+        std::cout << "20 " << creator << " " << a << std::endl;
+  std::cout << "21" << std::endl;
+        o = reinterpret_cast< _TPtr* >( a )->GetPointer( );
+  std::cout << "22" << std::endl;
+        o->SetName( name );
+  std::cout << "23" << std::endl;
+        o->SetPluginName( nam->second.first );
+  std::cout << "24" << std::endl;
+
+      } // fi
 
     } // fi
 
   } // fi
-
-  this->UnblockWidget( );
-  return( ret );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-LoadPluginsConfigurationFile( const std::string& fname )
-{
-  // Load file into a char buffer
-  std::ifstream in(
-    fname.c_str( ), std::ios::in | std::ios::binary | std::ios::ate
-    );
-  if( !in.is_open( ) )
-    return( false );
-
-  std::streampos size = in.tellg( );
-  char* buffer = new char[ size ];
-  in.seekg( 0, std::ios::beg );
-  in.read( buffer, size );
-  in.close( );
-
-  // Read stream
-  std::stringstream in_stream( buffer );
-  char line[ 4096 ];
-  while( in_stream )
-  {
-    in_stream.getline( line, 4096 );
-    this->LoadPlugins( line );
-
-  } // elihw
-  delete buffer;
-
-  return( true );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TStringContainer& cpPlugins::Interface::Plugins::
-GetLoadedPlugins( ) const
-{
-  return( this->m_LoadedPlugins );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetLoadedFilters( TStringContainer& filters ) const
-{
-  filters.clear( );
-  auto pIt = this->m_LoadedFilters.begin( );
-  for( ; pIt != this->m_LoadedFilters.end( ); ++pIt )
-    for( auto fIt = pIt->second.begin( ); fIt != pIt->second.end( ); ++fIt )
-      filters.insert( *fIt );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TStringContainer& cpPlugins::Interface::Plugins::
-GetLoadedFilters( const std::string& plugin ) const
-{
-  static const TStringContainer EMPTY;
-  auto pIt = this->m_LoadedFilters.find( plugin );
-  if( pIt != this->m_LoadedFilters.end( ) )
-    return( pIt->second );
-  else
-    return( EMPTY );
+  std::cout << "25" << std::endl;
+  if( o.IsNull( ) )
+    throw std::runtime_error(
+      std::string( "Could not create a valid ProcessObject of type \"" ) +
+      category + std::string( ":" ) +
+      name + std::string( "\"" )
+      );
+  std::cout << "26" << std::endl;
+  return( o );
 }
 
 // -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-AddInteractor( vtkRenderWindowInteractor* interactor )
+cpPlugins::Interface::Plugins::
+Plugins( )
+  : Superclass( )
 {
-  this->m_Interactors.insert( interactor );
+  cpPlugins::OS::DLLManager::TeaseLoadedLibraries( );
 }
 
 // -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-RemoveInteractor( vtkRenderWindowInteractor* interactor )
+cpPlugins::Interface::Plugins::
+~Plugins( )
 {
-  this->m_Interactors.erase( interactor );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-ClearInteractors( )
-{
-  this->m_Interactors.clear( );
-}
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Plugins_HasMacro( F )                                 \
-  bool cpPlugins::Interface::Plugins::                                  \
-  Has##F( ) const                                                       \
-  {                                                                     \
-    return( this->m_IOFilters.find( #F ) != this->m_IOFilters.end( ) ); \
-  }
-
-cpPlugins_Plugins_HasMacro( ImageReader );
-cpPlugins_Plugins_HasMacro( DicomSeriesReader );
-cpPlugins_Plugins_HasMacro( MeshReader );
-cpPlugins_Plugins_HasMacro( ImageWriter );
-cpPlugins_Plugins_HasMacro( MeshWriter );
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& fname, const std::string& parent )
-{
-  std::vector< std::string > fnames( 1, fname );
-  return( this->ReadImage( fnames, parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage(
-  const std::vector< std::string >& fnames, const std::string& parent
-  )
+PrintSelf( std::ostream& os, itk::Indent indent ) const
 {
-  // Activate reader
-  auto fIt = this->m_IOFilters.find( "ImageReader" );
-  if( fIt == this->m_IOFilters.end( ) )
-    return( "" );
-  this->m_ActiveFilter = fIt->second;
-
-  // Configure reader
-  TParameters* params = this->GetActiveFilterParameters( );
-  params->ClearStringList( "FileNames" );
-  for( auto nIt = fnames.begin( ); nIt != fnames.end( ); ++nIt )
-    params->AddToStringList( "FileNames", *nIt );
-
-  // Execute filter
-  std::string err = this->UpdateActiveFilter( );
-  if( err == "" )
+  for( auto i : this->m_Filters )
   {
-#error GET OBJECT NAME
-  }
-  else
-  {
-#error THROW ERROR
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& parent )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadDicomSeries( const std::string& parent )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh(
-  const std::string& fname, const std::string& parent
-  )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& parent )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-WriteDataObject(
-  const std::string& fname, const std::string& name
-  )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-WriteDataObject( const std::string& name )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ClearDataObjects( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeleteDataObject( const std::string& name )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetDataObjects( TStringContainer& names )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-GetParent( const std::string& name ) const
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetChildren(
-  TStringContainer& names, const std::string& name
-  ) const
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetRoots( TStringContainer& names ) const
-{
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-ActivateFilter( const std::string& name )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeactivateFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasActiveFilter( ) const
-{
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-IsActiveFilterInteractive( ) const
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetActiveFilterInputsNames( TStringContainer& names ) const
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-GetActiveFilterOutputsNames( TStringContainer& names ) const
-{
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-ConnectInputInActiveFilter(
-  const std::string& object_name, const std::string& input_name
-  )
-{
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-SetOutputNameInActiveFilter(
-  const std::string& new_object_name, const std::string& output_name
-  )
-{
-}
+    os << indent << "+ " << i.first << std::endl;
+    for( auto j : i.second )
+      os << indent << "|----> " << j.first << std::endl;
 
-// -------------------------------------------------------------------------
-TParameters* cpPlugins::Interface::Plugins::
-GetActiveFilterParameters( )
-{
-}
-
-// -------------------------------------------------------------------------
-const TParameters* cpPlugins::Interface::Plugins::
-GetActiveFilterParameters( ) const
-{
-}
-
-// -------------------------------------------------------------------------
-TProcessObject::DialogResult cpPlugins::Interface::Plugins::
-ConfigureActiveFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-UpdateActiveFilter( )
-{
+  } // rof
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::Plugins::
-_UpdateLoadedPluginsInformation( )
-{
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-_InsertNewData( TDataObject* dobj, const std::string& parent )
+_ReadPluginsPathsVariable( )
 {
-}
-
-/*
-  protected:
-  // MVC objects
-  QWidget*         m_Widget;
-  BaseApplication* m_Application;
-  
-  // Plugins interface
-  TInterface       m_Interface;
-  TStringContainer m_LoadedPlugins;
-  std::string      m_LastLoadedPlugin;
-  
-  // Loaded filters
-  std::map< std::string, TProcessObject::Pointer > m_IOFilters;
-  TProcessObject::Pointer                       m_ActiveFilter;
-  std::map< std::string, std::string >   m_ActiveFilterOutputs;
-  std::map< std::string, TStringContainer >    m_LoadedFilters;
-  
-  // Loaded data objects
-  typedef std::pair< std::string, TDataObject::Pointer >  _TTreeNode;
-  std::map< std::string, _TTreeNode > m_DataObjects;
-  
-  // Associated interactors
-  std::set< vtkRenderWindowInteractor* > m_Interactors;
-  };
-  
-  } // ecapseman
-  
-  } // ecapseman
-*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#include <cpPlugins/Interface/Config.h>
-
-#include <fstream>
-#include <sstream>
-
-#ifdef cpPlugins_Interface_QT4
-
-#include <QApplication>
-#include <QFileDialog>
-#include <QMenu>
-#include <QMessageBox>
-#include <QWidget>
-
-#ifdef _WIN32
-#  define PLUGIN_PREFIX ""
-#  define PLUGIN_EXT "dll"
-#  define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
-#else // Linux
-#  define PLUGIN_PREFIX "lib"
-#  define PLUGIN_EXT "so"
-#  define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
-#endif // _WIN32
-
-#endif // cpPlugins_Interface_QT4
-
-
-
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-AddInteractor( vtkRenderWindowInteractor* interactor )
-{
-  this->m_Interactors.insert( interactor );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-RemoveInteractor( vtkRenderWindowInteractor* interactor )
-{
-  this->m_Interactors.erase( interactor );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ClearInteractors( )
-{
-  this->m_Interactors.clear( );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasImageReader( ) const
-{
-  return( this->m_ImageReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasDicomSeriesReader( ) const
-{
-  return( this->m_DicomSeriesReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasMeshReader( ) const
-{
-  return( this->m_MeshReader.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasImageWriter( ) const
-{
-  return( this->m_ImageWriter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasMeshWriter( ) const
-{
-  return( this->m_MeshWriter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& fname, const std::string& parent )
-{
-  std::vector< std::string > fnames;
-  fnames.push_back( fname );
-  return( this->ReadImage( fnames, parent ) );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage(
-  const std::vector< std::string >& fnames, const std::string& parent
-  )
-{
-  // Check if object exists
-  if( this->m_ImageReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TParameters* params = this->m_ImageReader->GetParameters( );
-  params->ClearStringList( "FileNames" );
-  auto i = fnames.begin( );
-  for( ; i != fnames.end( ); ++i )
-    params->AddToStringList( "FileNames", *i );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TImage* image = this->m_ImageReader->GetOutput< TImage >( "Output" );
-    this->m_ImageReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( image, parent ) )
-      return( image->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading image." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadImage( const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_ImageReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TProcessObject::DialogResult dret =
-    this->m_ImageReader->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TImage* image = this->m_ImageReader->GetOutput< TImage >( "Output" );
-    this->m_ImageReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( image, parent ) )
-      return( image->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading image." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadDicomSeries( const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_DicomSeriesReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TProcessObject::DialogResult dret =
-    this->m_DicomSeriesReader->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_DicomSeriesReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TImage* image =
-      this->m_DicomSeriesReader->GetOutput< TImage >( "Output" );
-    this->m_DicomSeriesReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( image, parent ) )
-      return( image->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading image." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading image: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& fname, const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_MeshReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TParameters* params = this->m_MeshReader->GetParameters( );
-  params->SetString( "FileName", fname );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TMesh* mesh = this->m_MeshReader->GetOutput< TMesh >( "Output" );
-    this->m_MeshReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( mesh, parent ) )
-      return( mesh->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-ReadMesh( const std::string& parent )
-{
-  // Check if object exists
-  if( this->m_MeshReader.IsNull( ) )
-    return( "" );
-
-  // Configure object
-  TProcessObject::DialogResult dret =
-    this->m_MeshReader->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshReader->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err == "" )
-  {
-    TMesh* mesh = this->m_MeshReader->GetOutput< TMesh >( "Output" );
-    this->m_MeshReader->DisconnectOutputs( );
-
-    // Add newly added data
-    if( this->_InsertNewData( mesh, parent ) )
-      return( mesh->GetName( ) );
-    else
-      return( "" );
-  }
-  else
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( "" );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteImage( const std::string& fname, const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_ImageWriter.IsNull( ) )
-    return( false );
-  TImage* image = this->GetImage( name );
-  if( image == NULL )
-    return( false );
-
-  // Configure writer
-  this->m_ImageWriter->GetParameters( )->SetString( "FileName", fname );
-  this->m_ImageWriter->SetInput( "Input", image );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteImage( const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_ImageWriter.IsNull( ) )
-    return( false );
-  TImage* image = this->GetImage( name );
-  if( image == NULL )
-    return( false );
-
-  // Configure writer
-  TProcessObject::DialogResult dret = 
-    this->m_ImageWriter->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-  this->m_ImageWriter->SetInput( "Input", image );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ImageWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteMesh( const std::string& fname, const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_MeshWriter.IsNull( ) )
-    return( false );
-  TMesh* mesh = this->GetMesh( name );
-  if( mesh == NULL )
-    return( false );
-
-  // Configure writer
-  this->m_MeshWriter->GetParameters( )->SetString( "FileName", fname );
-  this->m_MeshWriter->SetInput( "Input", mesh );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-WriteMesh( const std::string& name )
-{
-  // Check if objects exist
-  if( this->m_MeshWriter.IsNull( ) )
-    return( false );
-  TMesh* mesh = this->GetMesh( name );
-  if( mesh == NULL )
-    return( false );
-
-  // Configure writer
-  TProcessObject::DialogResult dret = 
-    this->m_MeshWriter->ExecConfigurationDialog( this->m_Widget );
-  if( dret == TProcessObject::DialogResult_Cancel )
-    return( "" );
-  this->m_MeshWriter->SetInput( "Input", mesh );
-
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_MeshWriter->Update( );
-  this->UnblockWidget( );
-
-  // Get result, if any
-  if( err != "" )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error reading mesh." ),
-        QMessageBox::tr( err.c_str( ) )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr << "Error reading mesh: " << err << std::endl;
-#endif // cpPlugins_Interface_QT4
-    return( false );
-  }
-  else
-    return( true );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ClearDataObjects( )
-{
-  this->m_Objects.clear( );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeleteDataObject( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-  {
-    this->m_Objects.erase( i );
-
-    // Get children
-    std::vector< std::string > children;
-    for( i = this->m_Objects.begin( ); i != this->m_Objects.end( ); ++i )
-      if( i->second.first == name )
-        children.push_back( i->first );
-
-    // Erase children
-    auto c = children.begin( );
-    for( ; c != children.end( ); ++c )
-      this->DeleteDataObject( *c );
-    
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-GetParent( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( i->second.first );
-  else
-    return( "" );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TTree& cpPlugins::Interface::Plugins::
-GetDataObjects( ) const
-{
-  return( this->m_Objects );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TDataObject* cpPlugins::Interface::Plugins::
-GetDataObject( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< TDataObject* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TDataObject* cpPlugins::Interface::Plugins::
-GetDataObject( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return(
-      dynamic_cast< const TDataObject* >( i->second.second.GetPointer( ) )
-      );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TImage* cpPlugins::Interface::Plugins::
-GetImage( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< TImage* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TImage* cpPlugins::Interface::Plugins::
-GetImage( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< const TImage* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TMesh* cpPlugins::Interface::Plugins::
-GetMesh( const std::string& name )
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< TMesh* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TMesh* cpPlugins::Interface::Plugins::
-GetMesh( const std::string& name ) const
-{
-  auto i = this->m_Objects.find( name );
-  if( i != this->m_Objects.end( ) )
-    return( dynamic_cast< const TMesh* >( i->second.second.GetPointer( ) ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-ActivateFilter( const std::string& name )
-{
-  this->m_ActiveFilter = this->m_Interface.CreateProcessObject( name );
-  if( this->m_ActiveFilter.IsNotNull( ) )
-  {
-    this->m_ActiveFilter->SetPlugins( this );
-    this->m_ActiveFilterOutputs.clear( );
-    auto i = this->m_Interactors.begin( );
-    for( ; i != this->m_Interactors.end( ); ++i )
-      this->m_ActiveFilter->AddInteractor( *i );
-    return( true );
-  }
-  else
-    return( false );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-DeactivateFilter( )
-{
-  this->m_ActiveFilter = NULL;
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-HasActiveFilter( ) const
-{
-  return( this->m_ActiveFilter.IsNotNull( ) );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-IsActiveFilterInteractive( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->IsInteractive( ) );
-  else
-    return( false );
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpPlugins::Interface::Plugins::
-GetNumberOfInputsInActiveFilter( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetNumberOfInputs( ) );
-  else
-    return( 0 );
-}
-
-// -------------------------------------------------------------------------
-unsigned int cpPlugins::Interface::Plugins::
-GetNumberOfOutputsInActiveFilter( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetNumberOfOutputs( ) );
-  else
-    return( 0 );
-}
-
-// -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::Interface::Plugins::
-GetActiveFilterInputsNames( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetInputsNames( ) );
-  else
-    return( std::vector< std::string >( ) );
-}
-
-// -------------------------------------------------------------------------
-std::vector< std::string > cpPlugins::Interface::Plugins::
-GetActiveFilterOutputsNames( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetOutputsNames( ) );
-  else
-    return( std::vector< std::string >( ) );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-ConnectInputInActiveFilter(
-  const std::string& object_name, const std::string& input
-  )
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-  {
-    TDataObject* dobj = this->GetDataObject( object_name );
-    if( dobj != NULL )
-      this->m_ActiveFilter->SetInput( input, dobj );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-SetOutputNameInActiveFilter(
-  const std::string& new_name, const std::string& output
-  )
-{
-  this->m_ActiveFilterOutputs[ output ] = new_name;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TParameters* cpPlugins::Interface::Plugins::
-GetActiveFilterParameters( )
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetParameters( ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-const cpPlugins::Interface::Plugins::
-TParameters* cpPlugins::Interface::Plugins::
-GetActiveFilterParameters( ) const
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->GetParameters( ) );
-  else
-    return( NULL );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Plugins::
-TProcessObject::DialogResult cpPlugins::Interface::Plugins::
-ConfigureActiveFilter( )
-{
-  if( this->m_ActiveFilter.IsNotNull( ) )
-    return( this->m_ActiveFilter->ExecConfigurationDialog( this->m_Widget ) );
-  else
-    return( TProcessObject::DialogResult_Cancel );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Plugins::
-UpdateActiveFilter( std::vector< std::string >& outputs )
-{
-  // Execute filter
-  this->BlockWidget( );
-  std::string err = this->m_ActiveFilter->Update( );
-  this->UnblockWidget( );
-
-  // Associate outputs
-  outputs.clear( );
-  if( err == "" )
-  {
-    std::string parent = "";
-    if( this->GetNumberOfInputsInActiveFilter( ) > 0 )
-    {
-      std::string input = this->m_ActiveFilter->GetInputsNames( )[ 0 ];
-      parent =
-        this->m_ActiveFilter->GetInput< TDataObject >( input )->GetName( );
-
-    } // fi
-
-    auto i = this->m_ActiveFilterOutputs.begin( );
-    for( ; i != this->m_ActiveFilterOutputs.end( ); ++i )
-    {
-      TDataObject* out =
-        this->m_ActiveFilter->GetOutput< TDataObject >( i->first );
-      out->SetName( i->second );
-      outputs.push_back( out->GetName( ) );
-      this->_InsertNewData( out, parent );
-
-    } // rof
-
-  } // fi
-  return( err );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Plugins::
-_UpdateLoadedPluginsInformation( )
-{
-  typedef TInterface::TClasses _C;
-
-  this->m_Filters.clear( );
-  _C& classes = this->m_Interface.GetClasses( );
-  for( _C::const_iterator i = classes.begin( ); i != classes.end( ); ++i )
-  {
-    TProcessObject::Pointer o =
-      this->m_Interface.CreateProcessObject( i->first );
-    std::string name = o->GetClassName( );
-    std::string category = o->GetClassCategory( );
-    if( category == "ImageReader" )
-      this->m_ImageReader = o;
-    else if( category == "ImageWriter" )
-      this->m_ImageWriter = o;
-    else if( category == "MeshReader" )
-      this->m_MeshReader = o;
-    else if( category == "MeshWriter" )
-      this->m_MeshWriter = o;
-    else if( category == "DicomSeriesReader" )
-      this->m_DicomSeriesReader = o;
-    else
-      this->m_Filters[ category ].insert( name );
-
-  } // rof
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Plugins::
-_InsertNewData( TDataObject* dobj, const std::string& parent )
-{
-  std::string name = dobj->GetName( );
-  auto i = this->m_Objects.find( name );
-  bool ret = true;
-  if( i == this->m_Objects.end( ) )
-  {
-    if( parent != "" )
-    {
-      auto j = this->m_Objects.find( parent );
-      if( j != this->m_Objects.end( ) )
-        this->m_Objects[ name ] = TTreeNode( parent, dobj );
-      else
-        ret = false;
-    }
-    else
-      this->m_Objects[ name ] = TTreeNode( "", dobj );
-  }
-  else
-    i->second.second = dobj;
-
-  if( !ret )
-  {
-#ifdef cpPlugins_Interface_QT4
-    if( this->m_Widget != NULL )
-      QMessageBox::critical(
-        this->m_Widget,
-        QMessageBox::tr( "Error inserting data." ),
-        QMessageBox::tr( "Given parent does not exists." )
-        );
-#else // cpPlugins_Interface_QT4
-    std::cerr
-      << "Error inserting data: Given parent does not exists."
-      << std::endl;
-#endif // cpPlugins_Interface_QT4
-  } // fi
-  return( ret );
+#ifdef cpPlugins_OS_Windows
+  char* p;
+  size_t size;
+  _dupenv_s( &p, &size, cpPlugins_PATHS );
+#else // cpPlugins_OS_Windows
+  char* p = std::getenv( cpPlugins_PATHS );
+#endif // cpPlugins_OS_Windows
+  std::stringstream str;
+  if( p != NULL )
+    str << p << cpPlugins_ENV_SEPARATOR;
+  str << ".";
+  std::vector< std::string > tokens;
+  cpPlugins::Tokenize( tokens, str.str( ), cpPlugins_ENV_SEPARATOR );
+  for( auto dir : tokens )
+    this->m_PluginsPaths.insert( cpPlugins::CanonicalPath( dir ) );
 }
 
 // eof - $RCSfile$