physfs.h
changeset 8 41e4c6031535
parent 6 3662cbc014ef
child 15 418eacc97ac8
equal deleted inserted replaced
7:07d5e6e8259d 8:41e4c6031535
   298  *  call to this function will reflect that change. Fun.
   298  *  call to this function will reflect that change. Fun.
   299  *
   299  *
   300  * The returned value is an array of strings, with a NULL entry to signify the
   300  * The returned value is an array of strings, with a NULL entry to signify the
   301  *  end of the list:
   301  *  end of the list:
   302  *
   302  *
       
   303  * char **cds = PHYSFS_getCdRomDirs();
   303  * char **i;
   304  * char **i;
   304  *
   305  *
   305  * for (i = PHYSFS_getCdRomDirs(); *i != NULL; i++)
   306  * for (i = cds; *i != NULL; i++)
   306  *     printf("cdrom dir [%s] is available.\n", *i);
   307  *     printf("cdrom dir [%s] is available.\n", *i);
       
   308  *
       
   309  * PHYSFS_freeList(cds);
   307  *
   310  *
   308  * This call may block while drives spin up. Be forewarned.
   311  * This call may block while drives spin up. Be forewarned.
   309  *
   312  *
   310  * When you are done with the returned information, you may dispose of the
   313  * When you are done with the returned information, you may dispose of the
   311  *  resources by calling PHYSFS_freeList() with the returned pointer.
   314  *  resources by calling PHYSFS_freeList() with the returned pointer.
   459  *                   from other programs using PhysicsFS.
   462  *                   from other programs using PhysicsFS.
   460  *
   463  *
   461  *    @param archiveExt File extention used by your program to specify an
   464  *    @param archiveExt File extention used by your program to specify an
   462  *                      archive. For example, Quake 3 uses "pk3", even though
   465  *                      archive. For example, Quake 3 uses "pk3", even though
   463  *                      they are just zipfiles. Specify NULL to not dig out
   466  *                      they are just zipfiles. Specify NULL to not dig out
   464  *                      archives automatically.
   467  *                      archives automatically. Do not specify the '.' char;
       
   468  *                      If you want to look for ZIP files, specify "ZIP" and
       
   469  *                      not ".ZIP" ... the archive search is case-insensitive.
   465  *
   470  *
   466  *    @param includeCdRoms Non-zero to include CD-ROMs in the search path, and
   471  *    @param includeCdRoms Non-zero to include CD-ROMs in the search path, and
   467  *                         (if (archiveExt) != NULL) search them for archives.
   472  *                         (if (archiveExt) != NULL) search them for archives.
   468  *                         This may cause a significant amount of blocking
   473  *                         This may cause a significant amount of blocking
   469  *                         while discs are accessed, and if there are no discs
   474  *                         while discs are accessed, and if there are no discs
   472  *                         want to specify zero and handle the disc setup
   477  *                         want to specify zero and handle the disc setup
   473  *                         yourself.
   478  *                         yourself.
   474  *
   479  *
   475  *    @param archivesFirst Non-zero to prepend the archives to the search path.
   480  *    @param archivesFirst Non-zero to prepend the archives to the search path.
   476  *                          Zero to append them. Ignored if !(archiveExt).
   481  *                          Zero to append them. Ignored if !(archiveExt).
   477  */
   482  *  @return nonzero on success, zero on error. Specifics of the error can be
   478 void PHYSFS_setSaneConfig(const char *appName, const char *archiveExt,
   483  *          gleaned from PHYSFS_getLastError().
       
   484  */
       
   485 int PHYSFS_setSaneConfig(const char *appName, const char *archiveExt,
   479                           int includeCdRoms, int archivesFirst);
   486                           int includeCdRoms, int archivesFirst);
   480 
   487 
   481 
   488 
   482 /**
   489 /**
   483  * Create a directory. This is specified in platform-independent notation in
   490  * Create a directory. This is specified in platform-independent notation in
   667  *   @param buffer buffer to store read data into.
   674  *   @param buffer buffer to store read data into.
   668  *   @param objSize size in bytes of objects being read from (handle).
   675  *   @param objSize size in bytes of objects being read from (handle).
   669  *   @param objCount number of (objSize) objects to read from (handle).
   676  *   @param objCount number of (objSize) objects to read from (handle).
   670  *  @return number of objects read. PHYSFS_getLastError() can shed light on
   677  *  @return number of objects read. PHYSFS_getLastError() can shed light on
   671  *           the reason this might be < (objCount), as can PHYSFS_eof().
   678  *           the reason this might be < (objCount), as can PHYSFS_eof().
       
   679  *            -1 if complete failure.
   672  */
   680  */
   673 int PHYSFS_read(PHYSFS_file *handle, void *buffer,
   681 int PHYSFS_read(PHYSFS_file *handle, void *buffer,
   674                 unsigned int objSize, unsigned int objCount);
   682                 unsigned int objSize, unsigned int objCount);
   675 
   683 
   676 
   684 
   679  *
   687  *
   680  *   @param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
   688  *   @param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
   681  *   @param buffer buffer to store read data into.
   689  *   @param buffer buffer to store read data into.
   682  *   @param objSize size in bytes of objects being read from (handle).
   690  *   @param objSize size in bytes of objects being read from (handle).
   683  *   @param objCount number of (objSize) objects to read from (handle).
   691  *   @param objCount number of (objSize) objects to read from (handle).
   684  *  @return number of objects read. PHYSFS_getLastError() can shed light on
   692  *  @return number of objects written. PHYSFS_getLastError() can shed light on
   685  *           the reason this might be < (objCount).
   693  *           the reason this might be < (objCount). -1 if complete failure.
   686  */
   694  */
   687 int PHYSFS_write(PHYSFS_file *handle, void *buffer,
   695 int PHYSFS_write(PHYSFS_file *handle, void *buffer,
   688                  unsigned int objSize, unsigned int objCount);
   696                  unsigned int objSize, unsigned int objCount);
   689 
   697 
   690 
   698