From d32370ff12dae326d20d9789890b48395fea75cb Mon Sep 17 00:00:00 2001 From: imdongye Date: Mon, 26 Aug 2024 00:11:19 +0900 Subject: [PATCH] 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 --- include/assimp/scene.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/assimp/scene.h b/include/assimp/scene.h index 9137a856c..f3701d600 100644 --- a/include/assimp/scene.h +++ b/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;