diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 6eef4b93ae..35f44f46cd 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -40,16 +40,20 @@ namespace VFS std::transform(proper.begin() + prefix, proper.end(), std::back_inserter(searchable), normalize_function); - if (!mIndex.insert (std::make_pair (searchable, file)).second) + const auto inserted = mIndex.insert(std::make_pair(searchable, file)); + if (!inserted.second) Log(Debug::Warning) << "Warning: found duplicate file for '" << proper << "', please check your file system for two files with the same name in different cases."; + else + out[inserted.first->first] = &inserted.first->second; } - mBuiltIndex = true; } - - for (index::iterator it = mIndex.begin(); it != mIndex.end(); ++it) + else { - out[it->first] = &it->second; + for (index::iterator it = mIndex.begin(); it != mIndex.end(); ++it) + { + out[it->first] = &it->second; + } } }