]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Interface.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / Interface.cxx
index 9d7b2fe77752598673fab232c9f582437054fe29..2b5711b3fce82320879983e8bca22a4b3ed83517 100644 (file)
@@ -3,6 +3,7 @@
 #include <cstdlib>
 #include <fstream>
 #include <sstream>
+#include <Pluma/Pluma.hpp>
 
 #ifdef _WIN32
 #  define PLUGIN_PREFIX ""
@@ -37,7 +38,8 @@ namespace cpPlugins
 cpPlugins::Interface::Interface::
 Interface( )
 {
-  this->m_Pluma.acceptProviderType< ProcessObjectProvider >( );
+  this->m_Pluma = new pluma::Pluma( );
+  this->m_Pluma->acceptProviderType< ProcessObjectProvider >( );
 }
 
 // -------------------------------------------------------------------------
@@ -45,6 +47,7 @@ cpPlugins::Interface::Interface::
 ~Interface( )
 {
   this->UnloadAll( );
+  delete this->m_Pluma;
 }
 
 // -------------------------------------------------------------------------
@@ -168,7 +171,7 @@ Load( const std::string& path )
   bool ret = true;
   try
   {
-    ret = this->m_Pluma.load( path );
+    ret = this->m_Pluma->load( path );
     if( ret )
     {
       std::string folder, name;
@@ -194,11 +197,26 @@ Load( const std::string& folder, const std::string& name )
   PathSeparator sep;
   if( sep( folder[ folder.size( ) - 1 ] ) )
     real_folder = folder.substr( 0, folder.size( ) - 1 );
+#ifdef _WIN32
+  DWORD  retval=0;
+  BOOL   success; 
+  TCHAR  buffer[4096]=TEXT(""); 
+  TCHAR  buf[4096]=TEXT(""); 
+  TCHAR** lppPart={NULL};
+  // Retrieve the full path name for a file. 
+  // The file does not need to exist.
+  retval = GetFullPathName(folder.c_str( ),
+                 4096,
+                 buffer,
+                 lppPart);
+  real_folder = buffer;
+#else // _WIN32
   real_folder = std::string( realpath( real_folder.c_str( ), NULL ) );
+#endif // _WIN32
   bool ret = true;
   try
   {
-    ret = this->m_Pluma.load( real_folder, name );
+    ret = this->m_Pluma->load( real_folder, name );
     if( ret )
     {
       // Update loaded plugins
@@ -227,7 +245,7 @@ LoadFromFolder( const std::string& folder, bool r )
 {
   try
   {
-    std::list< std::string > f = this->m_Pluma.loadFromFolder( folder, r );
+    std::list< std::string > f = this->m_Pluma->loadFromFolder( folder, r );
     if( f.size( ) > 0 )
     {
       // Update loaded plugins
@@ -260,7 +278,7 @@ Unload( const std::string& name )
   bool ret = true;
   try
   {
-    ret = this->m_Pluma.unload( name );
+    ret = this->m_Pluma->unload( name );
     if( ret )
     {
       this->m_Providers.clear( );
@@ -286,7 +304,7 @@ UnloadAll( )
 {
   try
   {
-    this->m_Pluma.unloadAll( );
+    this->m_Pluma->unloadAll( );
   }
   catch( ... )
   {
@@ -302,7 +320,7 @@ UnloadAll( )
 bool cpPlugins::Interface::Interface::
 IsLoaded( const std::string& name ) const
 {
-  return( this->m_Pluma.isLoaded( name ) );
+  return( this->m_Pluma->isLoaded( name ) );
 }
 
 // -------------------------------------------------------------------------
@@ -311,7 +329,7 @@ _LoadClasses( )
 {
   this->m_Providers.clear( );
   this->m_Classes.clear( );
-  this->m_Pluma.getProviders( this->m_Providers );
+  this->m_Pluma->getProviders( this->m_Providers );
 
   // Get reader provider
   for( unsigned int i = 0; i < this->m_Providers.size( ); ++i )
@@ -329,7 +347,23 @@ _SepFName( const std::string& path, std::string& folder, std::string& name )
   PathSeparator sep;
 
   // Get absolute path
-  std::string real_path = std::string( realpath( path.c_str( ), NULL ) );
+  std::string real_path = "";
+#ifdef _WIN32
+  DWORD  retval=0;
+  BOOL   success; 
+  TCHAR  buffer[4096]=TEXT(""); 
+  TCHAR  buf[4096]=TEXT(""); 
+  TCHAR** lppPart={NULL};
+  // Retrieve the full path name for a file. 
+  // The file does not need to exist.
+  retval = GetFullPathName(path.c_str( ),
+                 4096,
+                 buffer,
+                 lppPart);
+  real_path = buffer;
+#else // _WIN32
+  real_path = std::string( realpath( path.c_str( ), NULL ) );
+#endif // _WIN32
 
   // Get name
   name = std::string(