Games may attempt to create files in %appdata%, which is not supported.
Redirect to the saves directory, prepending the gameid.
This fixes an immediate crash in "Beat the Buzzer" and "There's Something in
the Pipes", which create .ini files using the iniFile2 module.
Completes commit 8e77b04062d865e35bbadedce2fb7ba4971b837c.
We don't support subdirs in saves, the previous change causes some
games to be unable to save/restore
ScummVM does not support using sub-directories in the save directory,
so we flatten the path by replacing '/' with '-'.
This fixes saving and loading with the in-game dialogs in Strangeland.
Fixes bug #12864.
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 reapply the changes from 8fb9b5f9 to properly list the files
in the game data dir and in the savegame dir.
This for example fixes listing *.tra files in the options in
Kathy Rain.
This fixes bug #12477. Heroin's Quest tries to create a file named
"$SAVEGAMEDIR$\\hqrecord.dat" and when remapping this name the
second backslash was left in the name. Creating a file with a
backslash in the name worked on some system, but failed at least
on Windows.
The code was using ::remove() to remove files, and this does
not handle the "/saves/" prefix. Now it uses File::DeleteFile,
whose implementation was already fixed in the previous commit.
Also it only allows removing files from the savegame directory.
Since this is also the only directory where we allow creating
files, this is consistent and safer.
This function is used to list files that match a given pattern.
For example Kathy Rain uses it to list ./*.tra files. The
original engine uses al_findfirst() and al_findnext().
This fixes listing the available languages in the Kathy
Rain in-game options.
AGS uses agssave.xxx for its savegames, and it was already
changed to use the gameid in ScummVM, except when this is
called from scripts. Some games, such as If On A Winter's
Night Four Travelers, access savegames from scripts and
those are now mapped to ScummVm names. This solves the
missing Continue menu on the start screen for IOAWN4T
when we already saved the game.
Some games also save additional files in the save game
directory, and they can have generic names such as
'playersettings.dat', or 'user.cfg', and since we use
the same savegame path for all games, to avoid any
conflict we now prepend the game target name to all the
files created or read from there.