Skip to content

Commit

Permalink
Reuse already existing GetExtension helper.
Browse files Browse the repository at this point in the history
This way we can benefit from e.g. stripping away versioning information
attached behind the actual extension, see also assimp#5156.
  • Loading branch information
feuerste committed Jun 29, 2023
1 parent 0393412 commit 6a3d934
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/Common/Importer.cpp
Expand Up @@ -643,10 +643,10 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) {
for (std::set<std::string>::const_iterator it = extensions.cbegin(); it != extensions.cend(); ++it) {

// Yay for C++<20 not having std::string::ends_with()
std::string extension = "." + *it;
const std::string& extension = *it;
if (extension.length() <= pFile.length()) {
// Possible optimization: Fetch the lowercase filename!
if (0 == ASSIMP_stricmp(pFile.c_str() + pFile.length() - extension.length(), extension.c_str())) {
if (0 == ASSIMP_stricmp(BaseImporter::GetExtension(pFile), extension)) {
ImporterAndIndex candidate = { pimpl->mImporter[a], a };
possibleImporters.push_back(candidate);
break;
Expand Down

0 comments on commit 6a3d934

Please sign in to comment.