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 <kimkulling@users.noreply.github.com>
pull/5732/head
imdongye 2024-08-26 00:11:19 +09:00 committed by GitHub
parent 12ed0286e4
commit d32370ff12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

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