diff --git a/r5dev/engine/cmodel_bsp.cpp b/r5dev/engine/cmodel_bsp.cpp index 8b5549aa..7c7380dc 100644 --- a/r5dev/engine/cmodel_bsp.cpp +++ b/r5dev/engine/cmodel_bsp.cpp @@ -49,14 +49,23 @@ void Mod_GetAllInstalledMaps() CUtlVector fileList; AddFilesToList(fileList, "vpk", "vpk", nullptr, '/'); + std::cmatch regexMatches; std::lock_guard l(g_InstalledMapsMutex); + g_InstalledMaps.clear(); // Clear current list. - std::cmatch regexMatches; FOR_EACH_VEC(fileList, i) { - const CUtlString& fileName = fileList[i]; - std::regex_search(fileName.Get(), regexMatches, s_ArchiveRegex); + const CUtlString& filePath = fileList[i]; + + const char* pFilePath = filePath.Get(); + const char* pFileName = strrchr(pFilePath, '/')+1; + + // Should always point right in front of the last + // slash, as the files are loaded from 'vpk/'. + Assert(pFileName); + + std::regex_search(pFileName, regexMatches, s_ArchiveRegex); if (!regexMatches.empty()) {