diff options
| author | KiritoDv <kiritodev01@gmail.com> | 2024-04-08 18:09:12 -0600 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2024-04-08 18:09:34 -0600 |
| commit | 3918fde51a84f5035d6f74740195f0d91dd5c604 (patch) | |
| tree | b6274c3503af7cff7831b2272668d5659353631b /src/storm/SWrapper.cpp | |
| parent | b1d39534f3ee1f04601cdadffbc8a96bcbf0b4a6 (diff) | |
Fixed otr header generation and fixed some binary exporters
Diffstat (limited to 'src/storm/SWrapper.cpp')
| -rw-r--r-- | src/storm/SWrapper.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/storm/SWrapper.cpp b/src/storm/SWrapper.cpp index 4fa585d..788c273 100644 --- a/src/storm/SWrapper.cpp +++ b/src/storm/SWrapper.cpp @@ -43,33 +43,28 @@ bool SWrapper::CreateFile(const std::string& path, std::vector<char> data) { time(&theTime); #endif - char* raw = (char*) data.data(); + char* raw = data.data(); size_t size = data.size(); if(size == 0){ SPDLOG_ERROR("File at path {} is empty", path); - std::cout << "File empty: " << path << std::endl; return false; } if(size >> 32){ - SPDLOG_ERROR("File at path {} is too large with size {}", path, size); - return false; + throw std::runtime_error("File at path " + path + " is too large with size " + std::to_string(size)); } if(!SFileCreateFile(this->hMpq, path.c_str(), theTime, size, 0, MPQ_FILE_COMPRESS, &hFile)){ - SPDLOG_ERROR("Failed to create file at path {} with error {}", path, GetLastError()); - return false; + throw std::runtime_error("Failed to create file at path " + path + " with error " + std::to_string(GetLastError())); } if(!SFileWriteFile(hFile, (void*) raw, size, MPQ_COMPRESSION_ZLIB)){ - SPDLOG_ERROR("Failed to write file at path {} with error {}", path, GetLastError()); - return false; + throw std::runtime_error("Failed to write file at path " + path + " with error " + std::to_string(GetLastError())); } if(!SFileCloseFile(hFile)){ - SPDLOG_ERROR("Failed to close file at path {} with error {}", path, GetLastError()); - return false; + throw std::runtime_error("Failed to close file at path " + path + " with error " + std::to_string(GetLastError())); } return true; |
