AGS: Fix regression when trying to delete files

This for examples fixes deleting savegames from the ingame save
dialog in QfG2 AGDI.

The issue is that the file name we get from get_save_game_path(int)
in DeleteSaveSlot(int) contains the "/saves/" prefix, so we
cannot directly pass it to the ScummVM savefile manager.
This commit is contained in:
Thierry Crozat 2021-06-21 21:41:58 +01:00
parent edaabb3d9d
commit 30764bbc41
2 changed files with 3 additions and 4 deletions

View File

@ -73,10 +73,10 @@ int File_Delete(const char *fnmm) {
if (!ResolveScriptPath(fnmm, false, rp))
return 0;
if (::remove(rp.FullPath.GetCStr()) == 0)
if (File::DeleteFile(rp.FullPath))
return 1;
if (_G(errnum) == AL_ENOENT && !rp.AltPath.IsEmpty() && rp.AltPath.Compare(rp.FullPath) != 0)
return ::remove(rp.AltPath.GetCStr()) == 0 ? 1 : 0;
return File::DeleteFile(rp.AltPath) ? 1 : 0;
return 0;
}

View File

@ -111,8 +111,7 @@ void RestoreGameSlot(int slnum) {
void DeleteSaveSlot(int slnum) {
String nametouse;
nametouse = get_save_game_path(slnum);
g_system->getSavefileManager()->removeSavefile(nametouse);
Shared::File::DeleteFile(nametouse);
}
void PauseGame() {