DefaultIOSystem close assimp/assimp/issues/108 : use correct macro to

detect vs-compiler.
pull/666/head
Kim Kulling 2015-09-21 20:43:58 +02:00
parent 6b1cac5743
commit 34ee4c4b9a
2 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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