From be5faadff84547b54e601cedc9ed06708d47c9ba Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Mon, 21 Jan 2019 01:21:12 +0300 Subject: [PATCH] Fix compressed BSA loading on non-Windows systems --- components/bsa/compressedbsafile.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index 9ff0b67cef..40dbc28566 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -285,10 +285,15 @@ void CompressedBSAFile::readHeader() CompressedBSAFile::FileRecord CompressedBSAFile::getFileRecord(const std::string& str) const { - boost::filesystem::path p(str); + // Force-convert the path into something both Windows and UNIX can handle first + // to make sure Boost doesn't think the entire path is the filename on Linux + // and subsequently purge it to determine the file folder. + std::string path = str; + std::replace(path.begin(), path.end(), '\\', '/'); + + boost::filesystem::path p(path); std::string stem = p.stem().string(); std::string ext = p.extension().string(); - std::string filename = p.filename().string(); p.remove_filename(); std::string folder = p.string();