mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-13 00:13:17 +00:00
Merge branch 'errno' into 'master'
Print a more verbose message when we failed to write savegame See merge request OpenMW/openmw!4749
This commit is contained in:
commit
2ce697a366
1 changed files with 3 additions and 2 deletions
|
|
@ -332,14 +332,15 @@ void MWState::StateManager::saveGame(std::string_view description, const Slot* s
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
if (stream.fail())
|
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
|
// All good, write to file
|
||||||
std::ofstream filestream(slot->mPath, std::ios::binary);
|
std::ofstream filestream(slot->mPath, std::ios::binary);
|
||||||
filestream << stream.rdbuf();
|
filestream << stream.rdbuf();
|
||||||
|
|
||||||
if (filestream.fail())
|
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()));
|
Settings::saves().mCharacter.set(Files::pathToUnicodeString(slot->mPath.parent_path().filename()));
|
||||||
mLastSavegame = slot->mPath;
|
mLastSavegame = slot->mPath;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue