Selaa lähdekoodia

fix GetShortFilename function (#5728)

when blender export fbx then embedded texture path have slash and back slash.
so GetShortFilename have to check both types of slashes

Co-authored-by: Kim Kulling <[email protected]>
imdongye 1 vuosi sitten
vanhempi
commit
d32370ff12
1 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  1. 3 2
      include/assimp/scene.h

+ 3 - 2
include/assimp/scene.h

@@ -401,8 +401,9 @@ struct ASSIMP_API aiScene {
     //! Returns a short filename from a full path
     static const char* GetShortFilename(const char* filename) {
         const char* lastSlash = strrchr(filename, '/');
-        if (lastSlash == nullptr) {
-            lastSlash = strrchr(filename, '\\');
+        const char* lastBackSlash = strrchr(filename, '\\');
+        if (lastSlash < lastBackSlash) {
+            lastSlash = lastBackSlash;
         }
         const char* shortFilename = lastSlash != nullptr ? lastSlash + 1 : filename;
         return shortFilename;