Merge branch 'bak2bak' into 'next'

Autobackup old gamedatas (resolves #1031)

Closes #1031

See merge request STJr/SRB2!2030
This commit is contained in:
Sal 2023-07-24 09:12:05 +00:00
commit dd0ea188dd

View file

@ -4386,6 +4386,17 @@ void G_LoadGameData(gamedata_t *data)
{ {
goto datacorrupt; goto datacorrupt;
} }
// make a backup of the old data
char currentfilename[64];
char backupfilename[69];
char bak[5];
strcpy(bak, ".bak");
strcpy(currentfilename, gamedatafilename);
STRBUFCPY(backupfilename, strcat(currentfilename, bak));
FIL_WriteFile(va(pandf, srb2home, backupfilename), savebuffer, length);
} }
else else
#endif #endif