physfs_internal.h
changeset 467 99664d9842cb
parent 464 21c8e0d1578c
child 504 3420d82f9b01
--- a/physfs_internal.h	Wed Aug 21 02:58:30 2002 +0000
+++ b/physfs_internal.h	Wed Aug 21 02:59:15 2002 +0000
@@ -842,6 +842,7 @@
         /*
          * Returns non-zero if filename can be opened for reading.
          *  This filename is in platform-independent notation.
+         *  You should not follow symlinks.
          */
     int (*exists)(DirHandle *r, const char *name);
 
@@ -850,22 +851,34 @@
          *  This filename is in platform-independent notation.
          *  Symlinks should be followed; if what the symlink points
          *  to is missing, or isn't a directory, then the retval is zero.
+         *
+         * Regardless of success or failure, please set *fileExists to
+         *  non-zero if the file existed (even if it's a broken symlink!),
+         *  zero if it did not.
          */
-    int (*isDirectory)(DirHandle *r, const char *name);
+    int (*isDirectory)(DirHandle *r, const char *name, int *fileExists);
 
         /*
          * Returns non-zero if filename is really a symlink.
          *  This filename is in platform-independent notation.
+         *
+         * Regardless of success or failure, please set *fileExists to
+         *  non-zero if the file existed (even if it's a broken symlink!),
+         *  zero if it did not.
          */
-    int (*isSymLink)(DirHandle *r, const char *name);
+    int (*isSymLink)(DirHandle *r, const char *name, int *fileExists);
 
         /*
 	     * Retrieve the last modification time (mtime) of a file.
     	 *  Returns -1 on failure, or the file's mtime in seconds since
     	 *  the epoch (Jan 1, 1970) on success.
          *  This filename is in platform-independent notation.
+         *
+         * Regardless of success or failure, please set *exists to
+         *  non-zero if the file existed (even if it's a broken symlink!),
+         *  zero if it did not.
     	 */
-    PHYSFS_sint64 (*getLastModTime)(DirHandle *r, const char *filename);
+    PHYSFS_sint64 (*getLastModTime)(DirHandle *r, const char *fnm, int *exist);
 
         /*
          * Open file for reading, and return a FileHandle.
@@ -874,8 +887,12 @@
          *  you can opt to fail for the second call.
          * Fail if the file does not exist.
          * Returns NULL on failure, and calls __PHYSFS_setError().
+         *
+         * Regardless of success or failure, please set *fileExists to
+         *  non-zero if the file existed (even if it's a broken symlink!),
+         *  zero if it did not.
          */
-    FileHandle *(*openRead)(DirHandle *r, const char *filename);
+    FileHandle *(*openRead)(DirHandle *r, const char *fname, int *fileExists);
 
         /*
          * Open file for writing, and return a FileHandle.
@@ -1245,8 +1262,10 @@
 
 /*
  * Return non-zero if filename (in platform-dependent notation) exists.
- *  Symlinks should be followed; if what the symlink points to is missing,
- *  then the retval is false.
+ *  Symlinks should NOT be followed; at this stage, we do not care what the
+ *  symlink points to. Please call __PHYSFS_SetError() with the details of
+ *  why the file does not exist, if it doesn't; you are in a better position
+ *  to know (path not found, bogus filename, file itself is missing, etc).
  */
 int __PHYSFS_platformExists(const char *fname);
 
@@ -1258,7 +1277,6 @@
  */
 PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname);
 
-
 /*
  * Return non-zero if filename (in platform-dependent notation) is a symlink.
  */