From 7b547ba51dcb5ea16b16bdc159f8f0f23eddfb41 Mon Sep 17 00:00:00 2001 From: namreeb Date: Wed, 24 Jul 2024 08:01:36 -1000 Subject: [PATCH] Normalize MPQ paths when looking for alpha data files --- parser/MpqManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parser/MpqManager.cpp b/parser/MpqManager.cpp index d953b9a..9ea98ca 100644 --- a/parser/MpqManager.cpp +++ b/parser/MpqManager.cpp @@ -276,7 +276,12 @@ MpqManager::OpenFile(const std::string& file) for (auto const& i : MpqHandles) { - if (i.first != file_lower) + // if we are on Linux, the mpq filenames will use forward slashes + // instead of backslashes. this code could be cleaner. + std::string mpqPath = i.first; + std::replace(mpqPath.begin(), mpqPath.end(), '/', '\\'); + + if (mpqPath != file_lower) continue; // if we have found a match, there should be exactly two files in this