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+" );