mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 15:32:54 +00:00
- fixed: saving game to read-only file was erroneously reported as succeeded
This commit is contained in:
parent
554eb1c813
commit
49b790a8f6
1 changed files with 25 additions and 15 deletions
|
@ -2324,28 +2324,38 @@ void G_DoSaveGame (bool okForQuicksave, bool forceQuicksave, FString filename, c
|
|||
G_WriteSnapshots (savegame_filenames, savegame_content);
|
||||
|
||||
|
||||
WriteZip(filename, savegame_filenames, savegame_content);
|
||||
bool succeeded = false;
|
||||
|
||||
if (WriteZip(filename, savegame_filenames, savegame_content))
|
||||
{
|
||||
// Check whether the file is ok by trying to open it.
|
||||
FResourceFile *test = FResourceFile::OpenResourceFile(filename, true);
|
||||
if (test != nullptr)
|
||||
{
|
||||
delete test;
|
||||
succeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (succeeded)
|
||||
{
|
||||
savegameManager.NotifyNewSave(filename, description, okForQuicksave, forceQuicksave);
|
||||
BackupSaveName = filename;
|
||||
|
||||
if (longsavemessages) Printf("%s (%s)\n", GStrings("GGSAVED"), filename.GetChars());
|
||||
else Printf("%s\n", GStrings("GGSAVED"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf(PRINT_HIGH, "%s\n", GStrings("TXT_SAVEFAILED"));
|
||||
}
|
||||
|
||||
savegameManager.NotifyNewSave (filename, description, okForQuicksave, forceQuicksave);
|
||||
|
||||
// delete the JSON buffers we created just above. Everything else will
|
||||
// either still be needed or taken care of automatically.
|
||||
savegame_content[1].Clean();
|
||||
savegame_content[2].Clean();
|
||||
|
||||
// Check whether the file is ok by trying to open it.
|
||||
FResourceFile *test = FResourceFile::OpenResourceFile(filename, true);
|
||||
if (test != nullptr)
|
||||
{
|
||||
delete test;
|
||||
if (longsavemessages) Printf ("%s (%s)\n", GStrings("GGSAVED"), filename.GetChars());
|
||||
else Printf ("%s\n", GStrings("GGSAVED"));
|
||||
}
|
||||
else Printf(PRINT_HIGH, "%s\n", GStrings("TXT_SAVEFAILED"));
|
||||
|
||||
|
||||
BackupSaveName = filename;
|
||||
|
||||
// We don't need the snapshot any longer.
|
||||
level.info->Snapshot.Clean();
|
||||
|
||||
|
|
Loading…
Reference in a new issue