[physfs] Wishlist

Christoph Nelles evilazrael at evilazrael.de
Tue Jan 26 15:57:02 EST 2010

Hello Ryan,
hello folks,

i have some proposals for physfs:
1) A function PHYSFS_getFileSize() for getting the file size avoiding
the need to open a file before.
2) Using error codes instead of error messages
3) Plugin system for the archive handlers
4) Support for ISO images

1) Currently, if you want to know the size of a file, you have to open
the file and call PHYSFS_fileLength() and close the file. File
opening/closing may be quite expensive and a short cut function for
getting the file size from the metadata may be faster/handier. In the
case this info cannot be obtained from metadata -1 could still be
returned or a fallback for open/seek/tell/close could be performed. The
only big problem i see is that the reported file size on files currently
being written to may vary.

2) A numeric error code is easier to process in error handling than a
message string. A number/constant should not change while the
corresponding error message may change, perhaps due to localization or
spelling errors. Currently there are 6 languages available. Instead of
storing a pointer to the string, an error code may be stored and made
available, without necessarily breaking te current API. Proposed
functions: PHYSFS_getLastErrorCode(), PHYSFS_getErrorMessage(code),
PHYSFS_getErrorMessageLocalized(code,lang) or something similar.
PHYSFS_getLastError() may become a wrapper for

3) Using a VFS is really nice, but for some uncommon container files it
may be necessary for the using application to plug its archive handlers
into physfs during runtime. So it will be possible to continue using a
vanilla physfs shared object/DLL/etc with custom archive handlers from
the application. This requires the supported archive handlers array to
be dynamic. One user defined entry may be sufficient. A function for
special mounting may be needed too for "archives" not based on an
underlying file.

Personally I am thinking about a way to compile files directly into the
application binary. A resource identifier is nice, but unified access
via a VFS is nicer. Or something like a simple network file system for
streaming content from a server to a client.

4) Although an ISO can be unpacked easily, this may be useful for
reimplementations of old games and it's a quite common container.
Perhaps a candidate for #3 ;)

I will gladly implement or help implementing those features, but i have
only experience and access on/to Linux & Windows.

Please give me a feedback.

Christoph Nelles

E-Mail    : evilazrael at evilazrael.de
Jabber    : eazrael at evilazrael.net      ICQ       : 78819723

PGP-Key   : ID 0x424FB55B on subkeys.pgp.net
            or http://evilazrael.net/pgp.txt

More information about the physfs mailing list