[Scummvm-devel] mkdir SAVEPATH or not? And when?

Max Horn max at quendi.de
Sun Jan 21 11:40:07 CET 2007


Am 21.01.2007 um 11:21 schrieb Marcus Comstedt:

>
> Max Horn <max at quendi.de> writes:
>
>> So the best place to but it appears (to me) to be the (Default)
>> SaveFileManager. As such it would seem best to move  the relevant
>> mkdir code (still with the "#ifdef UNIX") to
>> DefaultSaveFileManager::openForSaving().
>>
>> Any comment / thoughts on this?
>
>
> Sounds like a reasonable approach.  One might argue that the
> DefaultSaveFileManager should not contain a lot of #ifdefs, as
> a platform needing some customization can subclass it, but
> let's not take the OO masturbation too far...  :-)

Still a good point, though! It might be better to have a  
POSIXSaveFileManager subclass, it wouldn't be hard to implement after  
all.


Also, there is another related (related to "OO vs #ifdef in save  
manager" I mean) problem present. Which probably is more severe: The  
default save manager implements (optionally, if zlib is present)  
compressed savegames. The drawback of this is that other save  
managers must either also implement the precise same, or they won't  
be able to load compressed save games made with it. Not sure whether  
any backend does that at all right now...

So a cleaner approach would be to implement the compression in a  
different way. Like, leaving the actual I/O code to the particular  
SaveFile implementations, while having the compression layer "in  
between" somehow (maybe by providing a special GZIPSaveFileWrapper  
class, which implements the SaveFile interface, and "wraps" itself  
around any other given SaveFile instance, just compressing the data  
on the fly as it is passed to it.
Does that make sense, I wonder? Would it be useful or am I solving a  
non-issue here? Or maybe even not solving a real issue? :-)


Cheers,
Max




More information about the Scummvm-devel mailing list