Make sure that the writing functions get used when a write mode is
authorRyan C. Gordon <icculus@icculus.org>
Wed, 26 Sep 2001 03:09:35 +0000
changeset 104 01f40ec3c62f
parent 103 cb5f60383994
child 105 842fb00667f9
Make sure that the writing functions get used when a write mode is specified.
archivers/dir.c
--- a/archivers/dir.c	Wed Sep 26 03:08:57 2001 +0000
+++ b/archivers/dir.c	Wed Sep 26 03:09:35 2001 +0000
@@ -209,7 +209,6 @@
     if (strcmp((name + namelen) - seplen, dirsep) != 0)
         strcat((char *) (retval->opaque), dirsep);
 
-    retval->funcs = &__PHYSFS_DirFunctions_DIR;
     return(retval);
 } /* DIR_openArchive */
 
@@ -293,7 +292,8 @@
 
     retval->opaque = (void *) rc;
     retval->dirHandle = h;
-    retval->funcs = &__PHYSFS_FileFunctions_DIR;
+    retval->funcs = (mode[0] == 'r') ?
+                &__PHYSFS_FileFunctions_DIR : &__PHYSFS_FileFunctions_DIRW;
     return(retval);
 } /* doOpen */