summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-12-15 19:44:34 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-12-15 19:44:34 +0000
commit528874bff76f12643d898cca70fd0960217b1ae9 (patch)
treed7f5ee653d1340f432acaf27257d8548959a8c91
parent567a7466739757d66314483fea5abd89d4d084d4 (diff)
downloadpcsxr-528874bff76f12643d898cca70fd0960217b1ae9.tar.gz
Passing CFStrings to UTTypeEqual for constant strings.
Better error handling in case we can't get a UTI for a file. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@73314 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--macosx/English.lproj/Localizable.strings2
-rw-r--r--macosx/PcsxrController.m18
2 files changed, 11 insertions, 9 deletions
diff --git a/macosx/English.lproj/Localizable.strings b/macosx/English.lproj/Localizable.strings
index 27b0e053..20d26d35 100644
--- a/macosx/English.lproj/Localizable.strings
+++ b/macosx/English.lproj/Localizable.strings
@@ -62,3 +62,5 @@
"No Free Space" = "No Free Space";
"Memory card %d doesn't have a free block on it. Please remove some blocks on that card to continue" = "Memory card %d doesn't have a free block on it. Please remove some blocks on that card to continue";
"Okay" = "Okay";
+"Error opening file" = "Error opening file";
+"Unable to open %@: %@" = "Unable to open %@: %@";
diff --git a/macosx/PcsxrController.m b/macosx/PcsxrController.m
index e78b8806..ebc4b2d1 100644
--- a/macosx/PcsxrController.m
+++ b/macosx/PcsxrController.m
@@ -464,25 +464,25 @@ static NSString *HandleBinCue(NSString *toHandle)
[PcsxrController setConfigFromDefaults];
}
-- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
-{
- return NO;
-}
-
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
- NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename error:nil];
- if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.plugin", (CFStringRef)utiFile)) {
+ NSError *err = nil;
+ NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename error:&err];
+ if (err) {
+ NSRunAlertPanel(NSLocalizedString(@"Error opening file",nil), [NSString stringWithFormat:NSLocalizedString(@"Unable to open %@: %@", nil), [filename lastPathComponent], [err localizedFailureReason]], nil, nil, nil);
+ return NO;
+ }
+ if(UTTypeEqual(CFSTR("com.codeplex.pcsxr.plugin"), (CFStringRef)utiFile)) {
PcsxrPluginHandler *hand = [[PcsxrPluginHandler alloc] init];
BOOL isHandled = [hand handleFile:filename];
[hand release];
return isHandled;
- } else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.memcard", (CFStringRef)utiFile)) {
+ } else if(UTTypeEqual(CFSTR("com.codeplex.pcsxr.memcard"), (CFStringRef)utiFile)) {
PcsxrMemCardHandler *hand = [[PcsxrMemCardHandler alloc] init];
BOOL isHandled = [hand handleFile:filename];
[hand release];
return isHandled;
- } else if(UTTypeEqual((CFStringRef)@"com.codeplex.pcsxr.freeze", (CFStringRef)utiFile)) {
+ } else if(UTTypeEqual(CFSTR("com.codeplex.pcsxr.freeze"), (CFStringRef)utiFile)) {
PcsxrFreezeStateHandler *hand = [[PcsxrFreezeStateHandler alloc] init];
BOOL isHandled = [hand handleFile:filename];
[hand release];