[Scummvm-devel] PORTERS: New OSystem API for loading/storing default config file

Andre Heider a.heider at gmail.com
Sat Aug 9 20:21:40 CEST 2008


a little late, but i just updated my local tree and noticed something:

ConfigManager::loadDefaultConfigFile() contains:

SeekableReadStream *stream = g_system->openConfigFileForReading();

the default implementation of openConfigFileForReading returns NULL if 
the file does not exist. scummvm now aborts if thats the case, thats a 
different behaviour now. is this intentional?

substituting the assert with "if (!stream) return;" restores this behaviour.

also, system.cpp contains this comment:

  Ideally, the default OSystem::openConfigFileForReading/Writing methods
  should be removed completely.

so should i implement these function in my port? the default (open 
scummvm.ini in the current dir) is exactly what i want.


Max Horn wrote:
> Hi everybody,
> based on the "File handling" thread, I think it would be a good idea
> to add two new OSystem methods for accessing the *default* confg file:
>  virtual Common::SeekableReadStream *openConfigFileForReading();
>  virtual Common::WriteStream *openConfigFileForWriting();
> (the latter method may return 0 to indicate that writing to the
> default config file is not possible).
> The attached patch does just that. Initially, this change should not
> have any impact on anybody (besides the usual regressions caused by my
> coding mistakes ;). However, this should enable us to gradually get
> rid of the #ifdef mess and other evil tricks we currently use to load
> the default config file from the correct location. E.g. the PS2 & PSP
> hacks using fake paths could be removed.
> I am interested in comments on this patch. Right now I am tempted to
> just commit it as-is, it just feels the "right" way to approach
> things. But I figure it's best to wait a bit to hear whether there is
> loud criticism or *gasp* even alternate proposals.
> Cheers,
> Max
> ------------------------------------------------------------------------
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
> _______________________________________________
> Scummvm-devel mailing list
> Scummvm-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scummvm-devel

More information about the Scummvm-devel mailing list