Fix bug with .sv2 file getting overwritten inside .savz file when writing savegames to fs_savegamedir.

This commit is contained in:
Knightmare66 2020-05-02 16:46:25 -04:00
parent 30012ce19c
commit 00dd6821ab
2 changed files with 4 additions and 4 deletions

View file

@ -808,7 +808,7 @@ int FS_FOpenCompressedFileWrite (fsHandle_t *handle, const char *zipName, const
Com_sprintf(path, sizeof(path), "%s/%s", fs_savegamedir, zipName); // was fs_gamedir
append = add ? (FS_LocalFileExists ((char *)zipName) ? 2 : 0) : 0;
append = add ? (FS_SaveFileExists ((char *)zipName) ? 2 : 0) : 0; // was FS_LocalFileExists()
handle->writeZip = zipOpen(path, append);
if (handle->writeZip)
{
@ -1135,7 +1135,7 @@ int FS_CompressFile (const char *fileName, const char *zipName, const char *inte
if (!fp)
return -1;
mode = FS_LocalFileExists((char *)zipName) ? FS_APPEND : FS_WRITE;
mode = FS_SaveFileExists((char *)zipName) ? FS_APPEND : FS_WRITE; // was FS_LocalFileExists()
size = FS_FOpenCompressedFile (zipName, internalName, &f, mode);
if (size == -1) {
fclose (fp);

View file

@ -239,9 +239,9 @@ void SV_CopySaveGame (char *src, char *dst)
FS_CopyFile (name, name2);
}
Com_sprintf (name, sizeof(name), "%s/save/%s/", FS_Gamedir(), src);
Com_sprintf (name, sizeof(name), "%s/save/%s/", FS_Savegamedir(), src); // was FS_Gamedir()
len = strlen(name);
// Com_sprintf (name, sizeof(name), "%s/save/%s/*.sav", FS_Gamedir(), src);
// Com_sprintf (name, sizeof(name), "%s/save/%s/*.sav", FS_Savegamedir(), src); // was FS_Gamedir()
for (i = 0; i < 2; i++)
{
Com_sprintf (name, sizeof(name), "%s/save/%s/*.%s", FS_Savegamedir(), src, saveExtensions[i]); // was FS_Gamedir()