From 1a24b6148708ca3b5c197a29e8690f6773c05eb1 Mon Sep 17 00:00:00 2001 From: Eric Wing Date: Sat, 8 May 2010 04:52:17 -0700 Subject: [PATCH] Exempted writable modes from bundle check on OS X since bundle areas are typically read-only. --- src/file/cocoa/SDL_rwopsbundlesupport.m | 6 ++++++ test/automated/rwops/Test_rwopsbundlesupport.m | 6 ++++++ test/automated/rwops/rwops.c | 2 -- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/file/cocoa/SDL_rwopsbundlesupport.m b/src/file/cocoa/SDL_rwopsbundlesupport.m index c357e94c3..d9ce0210a 100644 --- a/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -12,6 +12,12 @@ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode) { 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]; diff --git a/test/automated/rwops/Test_rwopsbundlesupport.m b/test/automated/rwops/Test_rwopsbundlesupport.m index 86c0fe52e..ebed430b9 100644 --- a/test/automated/rwops/Test_rwopsbundlesupport.m +++ b/test/automated/rwops/Test_rwopsbundlesupport.m @@ -12,6 +12,12 @@ FILE* Test_OpenFPFromBundleOrFallback(const char *file, const char *mode) { 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]; diff --git a/test/automated/rwops/rwops.c b/test/automated/rwops/rwops.c index 2dd7460ab..b65268766 100644 --- a/test/automated/rwops/rwops.c +++ b/test/automated/rwops/rwops.c @@ -227,7 +227,6 @@ static void rwops_testFP (void) /* 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 @@ static void rwops_testFP (void) /* Run write tests. */ #if __APPLE__ - /* Cheating: Using private API in SDL */ fp = Test_OpenFPFromTemporaryDir( RWOPS_WRITE, "w+" ); #else fp = fopen( RWOPS_WRITE, "w+" );