diff --git a/doomsday/plugins/common/src/g_game.cpp b/doomsday/plugins/common/src/g_game.cpp index be259363dd..61879315e9 100644 --- a/doomsday/plugins/common/src/g_game.cpp +++ b/doomsday/plugins/common/src/g_game.cpp @@ -479,7 +479,7 @@ gameaction_t G_GameAction() return gameAction; } -/// @return Relative path to a saved session in /home/savegames +/// @return Absolute path to a saved session in /home/savegames static inline de::String composeSavedSessionPathForSlot(int slot) { return de::String("/home/savegames") / G_IdentityKey() / SAVEGAMENAME + de::String::number(slot) + ".save"; @@ -986,7 +986,7 @@ static de::game::SavedSession *savedSessionByUserDescription(de::String descript { if(!description.isEmpty()) { - de::Folder &saveFolder = DENG2_APP->rootFolder().locate("home/savegames"); + de::Folder &saveFolder = DENG2_APP->rootFolder().locate(de::String("home/savegames") / G_IdentityKey()); DENG2_FOR_EACH_CONST(de::Folder::Contents, i, saveFolder.contents()) { if(de::game::SavedSession *session = i->second->maybeAs()) @@ -3035,6 +3035,8 @@ void G_DoLeaveMap() Writer_Delete(writer); SV_CloseFile(); outFile.setMode(de::File::ReadOnly); + + saveFolder.populate(); // Populate the new contents of the archive. } } else // Entering new hub. diff --git a/doomsday/plugins/common/src/gamesessionwriter.cpp b/doomsday/plugins/common/src/gamesessionwriter.cpp index 28cf354065..14ee10b92d 100644 --- a/doomsday/plugins/common/src/gamesessionwriter.cpp +++ b/doomsday/plugins/common/src/gamesessionwriter.cpp @@ -105,9 +105,12 @@ void GameSessionWriter::write(SessionMetadata const &metadata) de::Writer(save) << arch; save.setMode(File::ReadOnly); LOG_RES_MSG("Wrote ") << save.description(); - folder.populate(); - SavedSession &session = folder.locate(d->savePath.fileName()); + // We can now reinterpret and populate the contents of the archive. + File *updated = save.reinterpret(); + updated->as().populate(); + + SavedSession &session = updated->as(); session.cacheMetadata(metadata); // Avoid immediately reopening the .save package. d->saveRepo().add(session); } diff --git a/doomsday/plugins/common/src/saveslots.cpp b/doomsday/plugins/common/src/saveslots.cpp index 44db52fa2e..337892404f 100644 --- a/doomsday/plugins/common/src/saveslots.cpp +++ b/doomsday/plugins/common/src/saveslots.cpp @@ -224,9 +224,12 @@ void SaveSlots::Slot::copySavedSession(Slot const &source) de::Writer(save) << sourceSession.archive(); save.setMode(File::ReadOnly); LOG_RES_MSG("Wrote ") << save.description(); - saveFolder.populate(); - SavedSession &session = saveFolder.locate(d->savePath.fileName()); + // We can now reinterpret and populate the contents of the archive. + File *updated = save.reinterpret(); + updated->as().populate(); + + SavedSession &session = updated->as(); session.cacheMetadata(sourceSession.metadata()); // Avoid immediately opening the .save package. d->saveRepo().add(session); DENG2_ASSERT(d->session == &session); // Sanity check.