From 34ee4c4b9a1b862ad025e89e018ebfc763ef950c Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 21 Sep 2015 20:43:58 +0200 Subject: [PATCH] DefaultIOSystem close assimp/assimp/issues/108 : use correct macro to detect vs-compiler. --- code/DefaultIOSystem.cpp | 17 ++++++++++------- code/DefaultIOSystem.h | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/code/DefaultIOSystem.cpp b/code/DefaultIOSystem.cpp index 32ea03b71..b3f8dc093 100644 --- a/code/DefaultIOSystem.cpp +++ b/code/DefaultIOSystem.cpp @@ -135,8 +135,8 @@ inline void MakeAbsolutePath (const char* in, char* _out) { ai_assert(in && _out); char* ret; -#ifdef _WIN32 - ret = ::_fullpath(_out, in,PATHLIMIT); +#if defined _WIN32 && !defined __GNUC__ + ret = ::_fullpath( _out, in, PATHLIMIT ); #else // use realpath ret = realpath(in, _out); @@ -167,8 +167,8 @@ bool DefaultIOSystem::ComparePaths (const char* one, const char* second) const return !ASSIMP_stricmp(temp1,temp2); } - -std::string DefaultIOSystem::fileName(std::string path) +// ------------------------------------------------------------------------------------------------ +std::string DefaultIOSystem::fileName( const std::string &path ) { std::string ret = path; std::size_t last = ret.find_last_of("\\/"); @@ -177,7 +177,8 @@ std::string DefaultIOSystem::fileName(std::string path) } -std::string DefaultIOSystem::completeBaseName(std::string path) +// ------------------------------------------------------------------------------------------------ +std::string DefaultIOSystem::completeBaseName( const std::string &path ) { std::string ret = fileName(path); std::size_t pos = ret.find_last_of('.'); @@ -185,8 +186,8 @@ std::string DefaultIOSystem::completeBaseName(std::string path) return ret; } - -std::string DefaultIOSystem::absolutePath(std::string path) +// ------------------------------------------------------------------------------------------------ +std::string DefaultIOSystem::absolutePath( const std::string &path ) { std::string ret = path; std::size_t last = ret.find_last_of("\\/"); @@ -194,4 +195,6 @@ std::string DefaultIOSystem::absolutePath(std::string path) return ret; } +// ------------------------------------------------------------------------------------------------ + #undef PATHLIMIT diff --git a/code/DefaultIOSystem.h b/code/DefaultIOSystem.h index b46169f79..cc2118fb9 100644 --- a/code/DefaultIOSystem.h +++ b/code/DefaultIOSystem.h @@ -80,17 +80,17 @@ public: /** @brief get the file name of a full filepath * example: /tmp/archive.tar.gz -> archive.tar.gz */ - static std::string fileName(std::string path); + static std::string fileName( const std::string &path ); /** @brief get the complete base name of a full filepath * example: /tmp/archive.tar.gz -> archive.tar */ - static std::string completeBaseName(std::string path); + static std::string completeBaseName( const std::string &path); /** @brief get the path of a full filepath * example: /tmp/archive.tar.gz -> /tmp/ */ - static std::string absolutePath(std::string path); + static std::string absolutePath( const std::string &path); }; } //!ns Assimp