aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldEditorController.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2018-01-13 06:06:06 +0100
committerMax <post@wickenrode.com>2018-01-13 06:06:06 +0100
commit9c2f82c0f7326d71070731ce8248f164c00e06aa (patch)
tree19b92ac431187354fc0249ff187030a284a37dab /Source/SPFieldEditorController.m
parentf4ac8ae36e216f2b678e46f7c8f98e5a55c40c76 (diff)
downloadsequelpro-9c2f82c0f7326d71070731ce8248f164c00e06aa.tar.gz
sequelpro-9c2f82c0f7326d71070731ce8248f164c00e06aa.tar.bz2
sequelpro-9c2f82c0f7326d71070731ce8248f164c00e06aa.zip
Replace all calls to deprecated method +propertyListFromData:mutabilityOption:format:errorDescription:
Diffstat (limited to 'Source/SPFieldEditorController.m')
-rw-r--r--Source/SPFieldEditorController.m30
1 files changed, 20 insertions, 10 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index b79355b5..f1212c81 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -129,17 +129,27 @@ typedef enum {
// Load default QL types
NSMutableArray *qlTypesItems = [[NSMutableArray alloc] init];
NSError *readError = nil;
- NSString *convError = nil;
- NSPropertyListFormat format;
- NSData *defaultTypeData = [NSData dataWithContentsOfFile:[NSBundle pathForResource:@"EditorQuickLookTypes.plist" ofType:nil inDirectory:[[NSBundle mainBundle] bundlePath]]
- options:NSMappedRead error:&readError];
-
- NSDictionary *defaultQLTypes = [NSPropertyListSerialization propertyListFromData:defaultTypeData
- mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError];
- if(defaultQLTypes == nil || readError != nil || convError != nil)
- NSLog(@"Error while reading 'EditorQuickLookTypes.plist':\n%@\n%@", [readError localizedDescription], convError);
- if(defaultQLTypes != nil && [defaultQLTypes objectForKey:@"QuickLookTypes"]) {
+ NSString *filePath = [NSBundle pathForResource:@"EditorQuickLookTypes.plist"
+ ofType:nil
+ inDirectory:[[NSBundle mainBundle] bundlePath]];
+
+ NSData *defaultTypeData = [NSData dataWithContentsOfFile:filePath
+ options:NSMappedRead
+ error:&readError];
+
+ NSDictionary *defaultQLTypes = nil;
+ if(defaultTypeData && !readError) {
+ defaultQLTypes = [NSPropertyListSerialization propertyListWithData:defaultTypeData
+ options:NSPropertyListImmutable
+ format:NULL
+ error:&readError];
+ }
+
+ if(defaultQLTypes == nil || readError ) {
+ NSLog(@"Error while reading 'EditorQuickLookTypes.plist':\n%@", readError);
+ }
+ else if(defaultQLTypes != nil && [defaultQLTypes objectForKey:@"QuickLookTypes"]) {
for(id type in [defaultQLTypes objectForKey:@"QuickLookTypes"]) {
NSMenuItem *aMenuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""];
[aMenuItem setTag:tag];