- 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
|
|
@ -71,6 +71,7 @@
|
|||
#include "screenjob.h"
|
||||
#include "d_main.h"
|
||||
#include "i_interface.h"
|
||||
#include "savegamemanager.h"
|
||||
|
||||
EXTERN_CVAR (Int, disableautosave)
|
||||
EXTERN_CVAR (Int, autosavecount)
|
||||
|
|
@ -2457,21 +2458,8 @@ void Net_DoCommand (int type, uint8_t **stream, int player)
|
|||
{
|
||||
// Paths sent over the network will be valid for the system that sent
|
||||
// the save command. For other systems, the path needs to be changed.
|
||||
const char *fileonly = savegamefile.GetChars();
|
||||
const char *slash = strrchr (fileonly, '\\');
|
||||
if (slash != NULL)
|
||||
{
|
||||
fileonly = slash + 1;
|
||||
}
|
||||
slash = strrchr (fileonly, '/');
|
||||
if (slash != NULL)
|
||||
{
|
||||
fileonly = slash + 1;
|
||||
}
|
||||
if (fileonly != savegamefile.GetChars())
|
||||
{
|
||||
savegamefile = G_BuildSaveName (fileonly, -1);
|
||||
}
|
||||
FString basename = ExtractFileBase(savegamefile, true);
|
||||
savegamefile = G_BuildSaveName (basename);
|
||||
}
|
||||
}
|
||||
gameaction = ga_savegame;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue