summaryrefslogtreecommitdiff
path: root/macosx/plugins/Common/SDL/src
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-26 19:55:10 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-07-26 19:55:10 +0000
commitd663bbeb7c6958388d515c196bc73956b574ffbb (patch)
tree3093f1f1ecc383bfbef59a96e6e00056089daa46 /macosx/plugins/Common/SDL/src
parent13e08db872f4775ca23df12fcc03f1916ed9691e (diff)
downloadpcsxr-d663bbeb7c6958388d515c196bc73956b574ffbb.tar.gz
fixing the wrong project being non-arc.
Add a convinience function for running blocks on the main thread syncronously. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86262 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/Common/SDL/src')
-rw-r--r--macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m52
1 files changed, 27 insertions, 25 deletions
diff --git a/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m b/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m
index 2f69bc9a..888c0820 100644
--- a/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m
+++ b/macosx/plugins/Common/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m
@@ -12,31 +12,33 @@
*/
FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
{
- @autoreleasepool {
- 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);
- }
-
- NSFileManager* file_manager = [NSFileManager defaultManager];
- NSString* resource_path = [[NSBundle mainBundle] resourcePath];
-
- NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
-
- NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
- if([file_manager fileExistsAtPath:full_path_with_file_to_try])
- {
- fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
- }
- else
- {
- fp = fopen(file, mode);
- }
-
- return fp;
+ 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 *pool = [NSAutoreleasePool new];
+
+ NSFileManager* file_manager = [NSFileManager defaultManager];
+ NSString* resource_path = [[NSBundle mainBundle] resourcePath];
+
+ NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
+
+ NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
+ if([file_manager fileExistsAtPath:full_path_with_file_to_try])
+ {
+ fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
+ }
+ else
+ {
+ fp = fopen(file, mode);
+ }
+
+ [pool drain];
+
+ return fp;
}
#endif