Quellcode durchsuchen

DefaultIOSystem close assimp/assimp/issues/108 : use correct macro to
detect vs-compiler.

Kim Kulling vor 10 Jahren
Ursprung
Commit
34ee4c4b9a
2 geänderte Dateien mit 13 neuen und 10 gelöschten Zeilen
  1. 10 7
      code/DefaultIOSystem.cpp
  2. 3 3
      code/DefaultIOSystem.h

+ 10 - 7
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

+ 3 - 3
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