From 35d769c683c10f5c18d17a3e423d89f5b30a5b77 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Thu, 21 Jan 2016 23:10:12 -0500 Subject: [PATCH] ... --- lib/cpPlugins/Interface/Interface.cxx | 49 +++++++++------------------ 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/lib/cpPlugins/Interface/Interface.cxx b/lib/cpPlugins/Interface/Interface.cxx index 2b5711b..4576f84 100644 --- a/lib/cpPlugins/Interface/Interface.cxx +++ b/lib/cpPlugins/Interface/Interface.cxx @@ -34,6 +34,19 @@ namespace cpPlugins } // ecapseman +// ------------------------------------------------------------------------- +std::string cpPlugins_Interface_CanonicalPath( const std::string& path ) +{ +#ifdef _WIN32 + TCHAR buffer[ 4096 ] = TEXT( "" ); + TCHAR** lppPart = { NULL }; + GetFullPathName( path.c_str( ), 4096, buffer, lppPart ); + return( std::string( buffer ) ); +#else // Linux like + return( std::string( realpath( path.c_str( ), NULL ) ) ); +#endif // _WIN32 +} + // ------------------------------------------------------------------------- cpPlugins::Interface::Interface:: Interface( ) @@ -197,22 +210,8 @@ 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 + real_folder = cpPlugins_Interface_CanonicalPath( real_folder ); + bool ret = true; try { @@ -347,23 +346,7 @@ _SepFName( const std::string& path, std::string& folder, std::string& name ) PathSeparator sep; // Get absolute path - 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 + std::string real_path = cpPlugins_Interface_CanonicalPath( path ); // Get name name = std::string( -- 2.47.1