X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=lib%2FcpExtensions%2FUtility.h;h=b79f37985be42382e0d9ca36c156d2b06a29a152;hb=d8ebffc6ece697ddf7b358946ef5d9c9cd7191fe;hp=065dadf92fbee7f63f48b6cc2ff11f6180f0d572;hpb=c26e1b67af96bd1b11e8da2ab9145dbaf0140deb;p=cpPlugins.git diff --git a/lib/cpExtensions/Utility.h b/lib/cpExtensions/Utility.h index 065dadf..b79f379 100644 --- a/lib/cpExtensions/Utility.h +++ b/lib/cpExtensions/Utility.h @@ -8,18 +8,18 @@ #include // ------------------------------------------------------------------------- -#ifdef cpPlugins_OS_Windows +#ifdef cpExtensions_OS_Windows # define cpExtensions_STRTOK( A, B, N ) strtok_s( A, B, N ) # define cpExtensions_SPRINTF( B, S, O ) sprintf_s( B, S, "%s", O ); -#else // cpPlugins_OS_Windows +#else // cpExtensions_OS_Windows # define cpExtensions_STRTOK( A, B, N ) std::strtok( A, B ) # define cpExtensions_SPRINTF( B, S, O ) std::sprintf( B, "%s", O ); -#endif // cpPlugins_OS_Windows +#endif // cpExtensions_OS_Windows // ------------------------------------------------------------------------- -#define cpExtensions_CHRONO \ - std::chrono::duration_cast< std::chrono::milliseconds >( \ - std::chrono::system_clock::now( ).time_since_epoch( ) \ +#define cpExtensions_CHRONO \ + std::chrono::duration_cast< std::chrono::milliseconds >( \ + std::chrono::system_clock::now( ).time_since_epoch( ) \ ).count( ) // ------------------------------------------------------------------------- @@ -28,11 +28,11 @@ namespace cpExtensions // ----------------------------------------------------------------------- inline bool IsPathSeparator( char c ) { -#ifdef cpPlugins_Windows - return( c == '\\' || c == cpExtensions_PATH_SEPARATOR ); -#else // cpPlugins_Windows +#ifdef cpExtensions_OS_Windows + return( c == '/' || c == cpExtensions_PATH_SEPARATOR ); +#else // cpExtensions_OS_Windows return( c == cpExtensions_PATH_SEPARATOR ); -#endif // cpPlugins_Windows +#endif // cpExtensions_OS_Windows } // ----------------------------------------------------------------------- @@ -112,12 +112,12 @@ namespace cpExtensions inline std::string CanonicalPath( const std::string& path ) { std::string ret = ""; -#ifdef cpPlugins_OS_Windows +#ifdef cpExtensions_OS_Windows TCHAR buffer[ 4096 ] = TEXT( "" ); TCHAR** lppPart = { NULL }; GetFullPathName( path.c_str( ), 4096, buffer, lppPart ); ret = std::string( buffer ); -#else // cpPlugins_OS_Windows +#else // cpExtensions_OS_Windows char* canonical_path = realpath( path.c_str( ), NULL ); if( canonical_path != NULL ) { @@ -125,7 +125,7 @@ namespace cpExtensions free( canonical_path ); } // fi -#endif // cpPlugins_OS_Windows +#endif // cpExtensions_OS_Windows return( ret ); }