| 92 | std::streamsize MPQStream::size() const { return SFileGetFileSize(_mpqFile, nullptr); } |
| 93 | |
| 94 | MPQ::MPQ(const std::filesystem::path &mpqPath) : _stormMpq(nullptr) { |
| 95 | std::string path = std::filesystem::absolute(mpqPath).string(); |
| 96 | Common::Log::debug("Opening MPQ {}", path); |
| 97 | if (!SFileOpenArchive(path.c_str(), 0, STREAM_PROVIDER_FLAT | BASE_PROVIDER_FILE | STREAM_FLAG_READ_ONLY, &_stormMpq)) { |
| 98 | throw std::runtime_error(absl::StrCat("Error occurred while opening MPQ ", mpqPath.string())); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | MPQ::~MPQ() { SFileCloseArchive(_stormMpq); } |
| 103 | |