- overhaul of savegame path management.
* use a different subfolder for each IWAD's saves. * do not allow load and save CCMDs to escape the save folder. Absolute paths and '..' are being blocked now. * unified savegame path and filename generation in one single function. All ad-hoc file name generation was replaced. * -loadgame will also use the designated savegame folder now.
This commit is contained in:
parent
f0601a49a2
commit
ff37d710e2
8 changed files with 87 additions and 88 deletions
|
|
@ -68,14 +68,14 @@ void FSavegameManager::ReadSaveStrings()
|
|||
|
||||
LastSaved = LastAccessed = -1;
|
||||
quickSaveSlot = nullptr;
|
||||
filter = G_BuildSaveName("*." SAVEGAME_EXT, -1);
|
||||
filter = G_BuildSaveName("*");
|
||||
filefirst = I_FindFirst(filter.GetChars(), &c_file);
|
||||
if (filefirst != ((void *)(-1)))
|
||||
{
|
||||
do
|
||||
{
|
||||
// I_FindName only returns the file's name and not its full path
|
||||
FString filepath = G_BuildSaveName(I_FindName(&c_file), -1);
|
||||
FString filepath = G_BuildSaveName(I_FindName(&c_file));
|
||||
|
||||
std::unique_ptr<FResourceFile> savegame(FResourceFile::OpenResourceFile(filepath, true, true));
|
||||
if (savegame != nullptr)
|
||||
|
|
@ -252,7 +252,7 @@ FString FSavegameManager::ExtractSaveComment(FSerializer &arc)
|
|||
|
||||
FString FSavegameManager::BuildSaveName(const char* prefix, int slot)
|
||||
{
|
||||
return G_BuildSaveName(prefix, slot);
|
||||
return G_BuildSaveName(FStringf("%s%02d", prefix, slot));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue