[physfs] is PHYSFS_setSaneConfig() mandatory?

Ryan C. Gordon icculus at icculus.org
Mon Nov 28 08:28:10 EST 2005

> The reason why I ask, is beause PHYSFS_setWriteDir() does not create
> the directory that is given it, contrary to what the documentation
> says, and you cannot use PHYSFS_mkdir() before the write directory is
> set...

(Whoops, that's a documentation error, setSaneConfig shouldn't try to
make directories.)

> I would very much like to be able to avoid PHYSFS_setSaneConfig(),
> since I want a different write directory, and would like to avoid
> PHYSFS_setSaneConfig() writing its own in addition.

PHYSFS_setSaneConfig() isn't required.

Also, there's nothing in PHYSFS_setSaneConfig() that can't be done
outside of the library (although an internal case-insensitive string
compare snuck in there, you can replace it with stricmp/strcasecmp)...it
deliberately only uses external API calls, and really should have been a
piece of example code in the "extras" directory instead of an API
function itself...feel free to cut-and-paste the source to
PHYSFS_setSaneConfig() into your application and use just the pieces
that you need.

In your case, you probably want to set the write dir to some upper-level
directory, call PHYSFS_mkdir() to make the actual write directory you
want inside that upper-level directory, then call PHYSFS_setWriteDir()
again with the correct location. This is what PHYSFS_setSaneConfig does.


More information about the physfs mailing list