VpkLib: fix bug when parsing directory tree base name

After the regex update in commit 5266a2e9, this function had to be updated as well since the underscore is no longer returned.
This commit is contained in:
Kawe Mazidjatari 2024-01-14 22:56:52 +01:00
parent e51dfccc16
commit 1f2d4462d3
2 changed files with 6 additions and 6 deletions

View File

@ -91,9 +91,9 @@ void CPackedStoreBuilder::InitLzDecoder(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: gets the level name from the directory file name // Purpose: gets the level name from the directory file name
// Input : &dirFileName - // Input : &dirFileName -
// Output : level name as string (e.g. "mp_rr_box") // Output : level name as string (e.g. "englishclient_mp_rr_box")
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CUtlString PackedStore_GetDirLevelName(const CUtlString& dirFileName) CUtlString PackedStore_GetDirBaseName(const CUtlString& dirFileName)
{ {
const char* baseFileName = V_UnqualifiedFileName(dirFileName.String()); const char* baseFileName = V_UnqualifiedFileName(dirFileName.String());
@ -101,7 +101,7 @@ CUtlString PackedStore_GetDirLevelName(const CUtlString& dirFileName)
std::regex_search(baseFileName, regexMatches, s_DirFileRegex); std::regex_search(baseFileName, regexMatches, s_DirFileRegex);
CUtlString result; CUtlString result;
result.Format("%s%s", regexMatches[1].str().c_str(), regexMatches[2].str().c_str()); result.Format("%s_%s", regexMatches[1].str().c_str(), regexMatches[2].str().c_str());
return result; return result;
} }
@ -296,7 +296,7 @@ static void GetEntryBlocks(CUtlVector<VPKEntryBlock_t>& entryBlocks, FileHandle_
static bool GetEntryValues(CUtlVector<VPKKeyValues_t>& entryValues, static bool GetEntryValues(CUtlVector<VPKKeyValues_t>& entryValues,
const CUtlString& workspacePath, const CUtlString& dirFileName) const CUtlString& workspacePath, const CUtlString& dirFileName)
{ {
KeyValues* pManifestKV = GetManifest(workspacePath, PackedStore_GetDirLevelName(dirFileName)); KeyValues* pManifestKV = GetManifest(workspacePath, PackedStore_GetDirBaseName(dirFileName));
if (!pManifestKV) if (!pManifestKV)
{ {
@ -596,7 +596,7 @@ void CPackedStoreBuilder::UnpackStore(const VPKDir_t& vpkDir, const char* worksp
return; return;
} }
BuildManifest(vpkDir.m_EntryBlocks, workspacePath, PackedStore_GetDirLevelName(vpkDir.m_DirFilePath)); BuildManifest(vpkDir.m_EntryBlocks, workspacePath, PackedStore_GetDirBaseName(vpkDir.m_DirFilePath));
const CUtlString basePath = vpkDir.m_DirFilePath.StripFilename(false); const CUtlString basePath = vpkDir.m_DirFilePath.StripFilename(false);
for (uint16_t packFileIndex : vpkDir.m_PakFileIndices) for (uint16_t packFileIndex : vpkDir.m_PakFileIndices)

View File

@ -212,7 +212,7 @@ private:
std::unordered_map<string, const VPKChunkDescriptor_t&> m_ChunkHashMap; std::unordered_map<string, const VPKChunkDescriptor_t&> m_ChunkHashMap;
}; };
CUtlString PackedStore_GetDirLevelName(const CUtlString& dirFileName); CUtlString PackedStore_GetDirBaseName(const CUtlString& dirFileName);
CUtlString PackedStore_GetDirNameParts(const CUtlString& dirFileName, const int nCaptureGroup); CUtlString PackedStore_GetDirNameParts(const CUtlString& dirFileName, const int nCaptureGroup);
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////