diff --git a/src/Fbx2Raw.cpp b/src/Fbx2Raw.cpp index 44c338f..ef925f7 100644 --- a/src/Fbx2Raw.cpp +++ b/src/Fbx2Raw.cpp @@ -1323,6 +1323,9 @@ static void ReadAnimations(RawModel &raw, FbxScene *pScene) static std::string GetInferredFileName(const std::string &fbxFileName, const std::string &directory, const std::vector &directoryFileList) { + if (FileUtils::FileExists(fbxFileName)) { + return fbxFileName; + } // Get the file name with file extension. const std::string fileName = StringUtils::GetFileNameString(StringUtils::GetCleanPathString(fbxFileName)); diff --git a/src/utils/File_Utils.cpp b/src/utils/File_Utils.cpp index c3ea1d6..30ad6bf 100644 --- a/src/utils/File_Utils.cpp +++ b/src/utils/File_Utils.cpp @@ -55,6 +55,12 @@ namespace FileUtils { return std::string(cwd); } + bool FileExists(const std::string &filePath) + { + std::ifstream stream(filePath); + return stream.good(); + } + bool FolderExists(const std::string &folderPath) { #if defined( __unix__ ) || defined( __APPLE__ ) diff --git a/src/utils/File_Utils.h b/src/utils/File_Utils.h index 92bf40a..54795ce 100644 --- a/src/utils/File_Utils.h +++ b/src/utils/File_Utils.h @@ -13,6 +13,7 @@ namespace FileUtils { std::string GetCurrentFolder(); + bool FileExists(const std::string &folderPath); bool FolderExists(const std::string &folderPath); bool MatchExtension(const char *fileExtension, const char *matchExtensions);