Binary compatibility information. PHYSFS_ArchiveInfo info
Basic info about this archiver. void *(* openArchive )(PHYSFS_Io *io, const char *name, int forWrite, int *claimed)
Open an archive provided by (io). PHYSFS_EnumerateCallbackResult(* enumerate )(void *opaque, const char *dirname, PHYSFS_EnumerateCallback cb, const char *origdir, void *callbackdata)
List all files in (dirname). PHYSFS_Io *(* openRead )(void *opaque, const char *fnm)
Open a file in this archive for reading. PHYSFS_Io *(* openWrite )(void *opaque, const char *filename)
Open a file in this archive for writing. PHYSFS_Io *(* openAppend )(void *opaque, const char *filename)
Open a file in this archive for appending. int(* remove )(void *opaque, const char *filename)
Delete a file or directory in the archive. int(* mkdir )(void *opaque, const char *filename)
Create a directory in the archive. int(* stat )(void *opaque, const char *fn, PHYSFS_Stat *stat)
Obtain basic file metadata. void(* closeArchive )(void *opaque)
Destruct a previously-opened archive.
Historically, PhysicsFS provided a means to mount various archive file formats, and physical directories in the native filesystem. However, applications have been limited to the file formats provided by the library. This interface allows an application to provide their own archive file types.
Conceptually, a PHYSFS_Archiver provides directory entries, while PHYSFS_Io provides data streams for those directory entries. The most obvious use of PHYSFS_Archiver is to provide support for an archive file type that isn't provided by PhysicsFS directly: perhaps some proprietary format that only your application needs to understand.
Internally, all the built-in archive support uses this interface, so the best examples for building a PHYSFS_Archiver is the source code to PhysicsFS itself.
An archiver is added to the system with PHYSFS_registerArchiver(), and then it will be available for use automatically with PHYSFS_mount(); if a given archive can be handled with your archiver, it will be given control as appropriate.
These methods deal with dir handles. You have one instance of your archiver, and it generates a unique, opaque handle for each opened archive in its openArchive() method. Since the lifetime of an Archiver (not an archive) is generally the entire lifetime of the process, and it's assumed to be a singleton, we do not provide any instance data for the archiver itself; the app can just use some static variables if necessary.
Symlinks should always be followed (except in stat()); PhysicsFS will use the stat() method to check for symlinks and make a judgement on whether to continue to call other methods based on that.
Archivers, when necessary, should set the PhysicsFS error state with PHYSFS_setErrorCode() before returning. PhysicsFS will pass these errors back to the application unmolested in most cases.
Thread safety: PHYSFS_Archiver implementations are not guaranteed to be thread safe in themselves. PhysicsFS provides thread safety when it calls into a given archiver inside the library, but it does not promise that using the same PHYSFS_File from two threads at once is thread-safe; as such, your PHYSFS_Archiver can assume that locking is handled for you so long as the PHYSFS_Io you return from PHYSFS_open* doesn't change any of your Archiver state, as the PHYSFS_Io won't be as aggressively protected.
PHYSFS_EnumerateCallbackResult(* PHYSFS_Archiver::enumerate) (void *opaque, const char *dirname, PHYSFS_EnumerateCallback cb, const char *origdir, void *callbackdata)List all files in (dirname). Each file is passed to (cb), where a copy is made if appropriate, so you can dispose of it upon return from the callback. (dirname) is in platform-independent notation. If you have a failure, call PHYSFS_SetErrorCode() with whatever code seem appropriate and return PHYSFS_ENUM_ERROR. If the callback returns PHYSFS_ENUM_ERROR, please call PHYSFS_SetErrorCode(PHYSFS_ERR_APP_CALLBACK) and then return PHYSFS_ENUM_ERROR as well. Don't call the callback again in any circumstances. If the callback returns PHYSFS_ENUM_STOP, stop enumerating and return PHYSFS_ENUM_STOP as well. Don't call the callback again in any circumstances. Don't set an error code in this case. Callbacks are only supposed to return a value from PHYSFS_EnumerateCallbackResult. Any other result has undefined behavior. As long as the callback returned PHYSFS_ENUM_OK and you haven't experienced any errors of your own, keep enumerating until you're done and then return PHYSFS_ENUM_OK without setting an error code.
Return non-zero on success, zero on failure. This filename is in platform-independent notation. On failure, call PHYSFS_setErrorCode().
Returns non-zero on success, zero on failure. This filename is in platform-independent notation. On failure, call PHYSFS_setErrorCode().
|Sun Mar 24 2019||Version 3.0.2|