[physfs] My shot at PHYSFS_stat
evilazrael at evilazrael.de
Wed Feb 10 16:09:07 EST 2010
My shot at a PHYSFS_stat() function can be found at
It's implemented for all archivers and platforms, but only tested for
7z, dirs and on ubuntu 32bit and windows xp, but i am faithfull it will
work for other. It compiles with gcc 4.4 and Visual Studio. I have no
access to a PocketPC or OS/2 (is it still in use?)
There are 2 new functions, one enum and one struct. The enum lists four
file types, regular, directory, symlink and other. The struct
PHYSFS_Struct contains fields for size, type, last write, last access
and creation time and whether you can write a file or not. Writeable
means, if you query a file and it's the same you would get in the
writedir if you open the file for writing or appending. And of course if
you have the necessary permissions.
The function PHYSFS_stat(fname, *stat) takes the file name and and a
pointer to an PHYSFS_Struct in which the meta data will be stored. On
success zero will be returned.
This function calls PHYSFS_getFileInfo(fname, *filesize, *filetype,
*modtime, *createtime, *accesstime, *readonly) and passes in all fields.
You can call this function if you are only interested in a few values,
this may speedup things. If you want a particular value, send in a
pointer to a variable or NULL if you don't care. It returns zero on
success and fills in the requested data.
Please give me a feedback and tell me that my work was not in vain ;)
E-Mail : evilazrael at evilazrael.de
Jabber : eazrael at evilazrael.net ICQ : 78819723
PGP-Key : ID 0x424FB55B on subkeys.pgp.net
More information about the physfs