[Scummvm-devel] ATTN Porters: SaveFileManager API Adjustments
Johannes Schickel
lordhoto at scummvm.org
Thu Mar 17 00:14:36 CET 2016
On 03/16/2016 10:52 PM, Marcus Comstedt wrote:
> Johannes Schickel <lordhoto at scummvm.org> writes:
>
>> I finally merged (after forgetting I didn't already :-P) my PR
>> #682which makes SaveFileManager work with case insensitive save
>> names. This matches our other file related APIs for engines. I adapted
>> our default implementation used by most backends for this.
> Ok, I'm slightly confused by this. What does it mean exactly?
Basically, it means that you can access save files (and other engine
written files) without worrying about case issues on the underlying
hardware.
As you already discovered this gets problematic when you are on a case
sensitive file-system and there are conflicting files. But this should
really not happen from inside ScummVM itself with the new semantics (it
*was* a problem with the old one). Thus, I consider this a rather rare
case, where the backend can fix detailed semantics as it sees fitting.
> That openForLoading("foo") is supposed to be able to also open the
> files "Foo" or "FOO"? What if both exist? Which one should be
> opened?
That's really up to the backend. It is a good idea to issue a warning in
this case.
> That removeSavefile("foo") should also remove both the files "Foo" and
> "FOO"?
Up to you too.
> That openForSaving("foo") should remove "Foo" and "FOO" if they exist?
I wouldn't necessarily make an open call remove files.
> And finally, what is the point of all this? When would the engine
> ever use a filename with the wrong case?
>
Casing in target names is one possibility where different cases can
originate from. We have (semi) case insensitive target name handling,
i.e. the case of the target doesn't matter when you run games. However,
engines most of the time only query saves through that exact target name.
Synching files between devices and/or manually inserting save files
(from bug reports etc.) is another source for different cases.
Last but not least, all other engine facing high level file APIs are
case insensitive, i.e. file opening etc., this change makes
SaveFileManager fit in. This is especially important because some
engines use SaveFileManager to write additional files where file names
come from original game data which were developed on case insensitive
file systems (thus might not care about it). They could of course worry
about providing consistent file names but I went in favor of having a
consistent API.
// Johannes
More information about the Scummvm-devel
mailing list