From 1f5bfcecaf07f48e16ca55201faa50e597239042 Mon Sep 17 00:00:00 2001
From: Leonardo Florez Valencia <florez-l@javeriana.edu.co>
Date: Thu, 21 Jan 2016 22:29:12 -0500
Subject: [PATCH] ...

---
 lib/cpPlugins/Interface/Interface.cxx | 52 ++++++++++++++++++++++-----
 lib/cpPlugins/Interface/Interface.h   |  9 +++--
 lib/cpPlugins/Interface/Object.cxx    |  2 +-
 lib/cpPlugins/Interface/Object.h      |  2 +-
 lib/cpPlugins/Interface/Workspace.h   |  2 +-
 5 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/lib/cpPlugins/Interface/Interface.cxx b/lib/cpPlugins/Interface/Interface.cxx
index 9d7b2fe..2b5711b 100644
--- a/lib/cpPlugins/Interface/Interface.cxx
+++ b/lib/cpPlugins/Interface/Interface.cxx
@@ -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(
diff --git a/lib/cpPlugins/Interface/Interface.h b/lib/cpPlugins/Interface/Interface.h
index 2c4ad5e..94718f8 100644
--- a/lib/cpPlugins/Interface/Interface.h
+++ b/lib/cpPlugins/Interface/Interface.h
@@ -4,12 +4,17 @@
 #include <map>
 #include <string>
 #include <vector>
-#include <Pluma/Pluma.hpp>
 
 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
 #include <cpPlugins/Interface/Object.h>
 #include <cpPlugins/Interface/ProcessObject.h>
 
+// Some forward declarations
+namespace pluma
+{
+  class Pluma;
+}
+
 namespace cpPlugins
 {
   namespace Interface
@@ -62,7 +67,7 @@ namespace cpPlugins
         );
 
     protected:
-      pluma::Pluma   m_Pluma;
+      pluma::Pluma*  m_Pluma;
       TProviders     m_Providers;
       TClasses       m_Classes;
       TLoadedPlugins m_LoadedPlugins;
diff --git a/lib/cpPlugins/Interface/Object.cxx b/lib/cpPlugins/Interface/Object.cxx
index 583f59a..61da5c1 100644
--- a/lib/cpPlugins/Interface/Object.cxx
+++ b/lib/cpPlugins/Interface/Object.cxx
@@ -15,7 +15,7 @@ Modified( ) const
 }
 
 // -------------------------------------------------------------------------
-float cpPlugins::Interface::Object::
+void cpPlugins::Interface::Object::
 SetViewCoords( float x, float y )
 {
   this->SetViewX( x );
diff --git a/lib/cpPlugins/Interface/Object.h b/lib/cpPlugins/Interface/Object.h
index 0adfa8e..92de13c 100644
--- a/lib/cpPlugins/Interface/Object.h
+++ b/lib/cpPlugins/Interface/Object.h
@@ -41,7 +41,7 @@ namespace cpPlugins
 
     public:
       virtual void Modified( ) const;
-      float SetViewCoords( float x, float y );
+      void SetViewCoords( float x, float y );
 
       template< class T >
         inline T* GetITK( );
diff --git a/lib/cpPlugins/Interface/Workspace.h b/lib/cpPlugins/Interface/Workspace.h
index 5df33ae..ec55470 100644
--- a/lib/cpPlugins/Interface/Workspace.h
+++ b/lib/cpPlugins/Interface/Workspace.h
@@ -136,7 +136,7 @@ namespace cpPlugins
       TPlugins* m_Plugins;
 
       // Processing graph
-      typename TGraph::Pointer m_Graph;
+      TGraph::Pointer m_Graph;
       TExposedPorts m_ExposedInputPorts;
       TExposedPorts m_ExposedOutputPorts;
 
-- 
2.49.0