Exempted writable modes from bundle check on OS X since bundle areas are typically read-only.
authorEric Wing <ewing . public |-at-| gmail . com>
Sat, 08 May 2010 04:52:17 -0700
changeset 4449 8f73f4a3c972
parent 4448 2efcb52ba90a
child 4450 abd88bbaea2a
Exempted writable modes from bundle check on OS X since bundle areas are typically read-only.
src/file/cocoa/SDL_rwopsbundlesupport.m
test/automated/rwops/Test_rwopsbundlesupport.m
test/automated/rwops/rwops.c
--- a/src/file/cocoa/SDL_rwopsbundlesupport.m	Sat May 08 01:12:55 2010 -0700
+++ b/src/file/cocoa/SDL_rwopsbundlesupport.m	Sat May 08 04:52:17 2010 -0700
@@ -12,6 +12,12 @@
 {
     FILE* fp = NULL;
 
+	// If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
+	if(strcmp("r", mode) && strcmp("rb", mode))
+	{
+		return fopen(file, mode);
+	}
+
 	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
 
 
--- a/test/automated/rwops/Test_rwopsbundlesupport.m	Sat May 08 01:12:55 2010 -0700
+++ b/test/automated/rwops/Test_rwopsbundlesupport.m	Sat May 08 04:52:17 2010 -0700
@@ -12,6 +12,12 @@
 {
     FILE* fp = NULL;
 
+	// If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only.
+	if(strcmp("r", mode) && strcmp("rb", mode))
+	{
+		return fopen(file, mode);
+	}
+	
 	NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init];
 
 
--- a/test/automated/rwops/rwops.c	Sat May 08 01:12:55 2010 -0700
+++ b/test/automated/rwops/rwops.c	Sat May 08 04:52:17 2010 -0700
@@ -227,7 +227,6 @@
 
    /* Run read tests. */
 #if __APPLE__
-	/* Cheating: Using private API in SDL */
 	fp = Test_OpenFPFromBundleOrFallback( RWOPS_READ, "r" );
 #else
    fp = fopen( RWOPS_READ, "r" );
@@ -243,7 +242,6 @@
 
    /* Run write tests. */
 #if __APPLE__
-	/* Cheating: Using private API in SDL */
 	fp = Test_OpenFPFromTemporaryDir( RWOPS_WRITE, "w+" );
 #else
    fp = fopen( RWOPS_WRITE, "w+" );