1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-07 18:00:55 +00:00

Print a more verbose message when we failed to write savegame

This commit is contained in:
Andrei Kortunov 2025-07-06 11:18:23 +04:00
parent 1a08565a20
commit 779840deea

View file

@ -332,14 +332,15 @@ void MWState::StateManager::saveGame(std::string_view description, const Slot* s
writer.close();
if (stream.fail())
throw std::runtime_error("Write operation failed (memory stream)");
throw std::runtime_error(
"Write operation failed (memory stream): " + std::generic_category().message(errno));
// All good, write to file
std::ofstream filestream(slot->mPath, std::ios::binary);
filestream << stream.rdbuf();
if (filestream.fail())
throw std::runtime_error("Write operation failed (file stream)");
throw std::runtime_error("Write operation failed (file stream): " + std::generic_category().message(errno));
Settings::saves().mCharacter.set(Files::pathToUnicodeString(slot->mPath.parent_path().filename()));
mLastSavegame = slot->mPath;