physfs_internal.h
changeset 467 99664d9842cb
parent 464 21c8e0d1578c
child 504 3420d82f9b01
equal deleted inserted replaced
466:1e3b97bcdee4 467:99664d9842cb
   840 
   840 
   841 
   841 
   842         /*
   842         /*
   843          * Returns non-zero if filename can be opened for reading.
   843          * Returns non-zero if filename can be opened for reading.
   844          *  This filename is in platform-independent notation.
   844          *  This filename is in platform-independent notation.
       
   845          *  You should not follow symlinks.
   845          */
   846          */
   846     int (*exists)(DirHandle *r, const char *name);
   847     int (*exists)(DirHandle *r, const char *name);
   847 
   848 
   848         /*
   849         /*
   849          * Returns non-zero if filename is really a directory.
   850          * Returns non-zero if filename is really a directory.
   850          *  This filename is in platform-independent notation.
   851          *  This filename is in platform-independent notation.
   851          *  Symlinks should be followed; if what the symlink points
   852          *  Symlinks should be followed; if what the symlink points
   852          *  to is missing, or isn't a directory, then the retval is zero.
   853          *  to is missing, or isn't a directory, then the retval is zero.
   853          */
   854          *
   854     int (*isDirectory)(DirHandle *r, const char *name);
   855          * Regardless of success or failure, please set *fileExists to
       
   856          *  non-zero if the file existed (even if it's a broken symlink!),
       
   857          *  zero if it did not.
       
   858          */
       
   859     int (*isDirectory)(DirHandle *r, const char *name, int *fileExists);
   855 
   860 
   856         /*
   861         /*
   857          * Returns non-zero if filename is really a symlink.
   862          * Returns non-zero if filename is really a symlink.
   858          *  This filename is in platform-independent notation.
   863          *  This filename is in platform-independent notation.
   859          */
   864          *
   860     int (*isSymLink)(DirHandle *r, const char *name);
   865          * Regardless of success or failure, please set *fileExists to
       
   866          *  non-zero if the file existed (even if it's a broken symlink!),
       
   867          *  zero if it did not.
       
   868          */
       
   869     int (*isSymLink)(DirHandle *r, const char *name, int *fileExists);
   861 
   870 
   862         /*
   871         /*
   863 	     * Retrieve the last modification time (mtime) of a file.
   872 	     * Retrieve the last modification time (mtime) of a file.
   864     	 *  Returns -1 on failure, or the file's mtime in seconds since
   873     	 *  Returns -1 on failure, or the file's mtime in seconds since
   865     	 *  the epoch (Jan 1, 1970) on success.
   874     	 *  the epoch (Jan 1, 1970) on success.
   866          *  This filename is in platform-independent notation.
   875          *  This filename is in platform-independent notation.
       
   876          *
       
   877          * Regardless of success or failure, please set *exists to
       
   878          *  non-zero if the file existed (even if it's a broken symlink!),
       
   879          *  zero if it did not.
   867     	 */
   880     	 */
   868     PHYSFS_sint64 (*getLastModTime)(DirHandle *r, const char *filename);
   881     PHYSFS_sint64 (*getLastModTime)(DirHandle *r, const char *fnm, int *exist);
   869 
   882 
   870         /*
   883         /*
   871          * Open file for reading, and return a FileHandle.
   884          * Open file for reading, and return a FileHandle.
   872          *  This filename is in platform-independent notation.
   885          *  This filename is in platform-independent notation.
   873          * If you can't handle multiple opens of the same file,
   886          * If you can't handle multiple opens of the same file,
   874          *  you can opt to fail for the second call.
   887          *  you can opt to fail for the second call.
   875          * Fail if the file does not exist.
   888          * Fail if the file does not exist.
   876          * Returns NULL on failure, and calls __PHYSFS_setError().
   889          * Returns NULL on failure, and calls __PHYSFS_setError().
   877          */
   890          *
   878     FileHandle *(*openRead)(DirHandle *r, const char *filename);
   891          * Regardless of success or failure, please set *fileExists to
       
   892          *  non-zero if the file existed (even if it's a broken symlink!),
       
   893          *  zero if it did not.
       
   894          */
       
   895     FileHandle *(*openRead)(DirHandle *r, const char *fname, int *fileExists);
   879 
   896 
   880         /*
   897         /*
   881          * Open file for writing, and return a FileHandle.
   898          * Open file for writing, and return a FileHandle.
   882          * If the file does not exist, it should be created. If it exists,
   899          * If the file does not exist, it should be created. If it exists,
   883          *  it should be truncated to zero bytes. The writing
   900          *  it should be truncated to zero bytes. The writing
  1243  */
  1260  */
  1244 int __PHYSFS_platformStricmp(const char *str1, const char *str2);
  1261 int __PHYSFS_platformStricmp(const char *str1, const char *str2);
  1245 
  1262 
  1246 /*
  1263 /*
  1247  * Return non-zero if filename (in platform-dependent notation) exists.
  1264  * Return non-zero if filename (in platform-dependent notation) exists.
  1248  *  Symlinks should be followed; if what the symlink points to is missing,
  1265  *  Symlinks should NOT be followed; at this stage, we do not care what the
  1249  *  then the retval is false.
  1266  *  symlink points to. Please call __PHYSFS_SetError() with the details of
       
  1267  *  why the file does not exist, if it doesn't; you are in a better position
       
  1268  *  to know (path not found, bogus filename, file itself is missing, etc).
  1250  */
  1269  */
  1251 int __PHYSFS_platformExists(const char *fname);
  1270 int __PHYSFS_platformExists(const char *fname);
  1252 
  1271 
  1253 /*
  1272 /*
  1254  * Return the last modified time (in seconds since the epoch) of a file.
  1273  * Return the last modified time (in seconds since the epoch) of a file.
  1255  *  Returns -1 on failure. (fname) is in platform-dependent notation.
  1274  *  Returns -1 on failure. (fname) is in platform-dependent notation.
  1256  *  Symlinks should be followed; if what the symlink points to is missing,
  1275  *  Symlinks should be followed; if what the symlink points to is missing,
  1257  *  then the retval is -1.
  1276  *  then the retval is -1.
  1258  */
  1277  */
  1259 PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname);
  1278 PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname);
  1260 
       
  1261 
  1279 
  1262 /*
  1280 /*
  1263  * Return non-zero if filename (in platform-dependent notation) is a symlink.
  1281  * Return non-zero if filename (in platform-dependent notation) is a symlink.
  1264  */
  1282  */
  1265 int __PHYSFS_platformIsSymLink(const char *fname);
  1283 int __PHYSFS_platformIsSymLink(const char *fname);