aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPBundleEditorController.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/SPBundleEditorController.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/SPBundleEditorController.m')
-rw-r--r--Source/SPBundleEditorController.m65
1 files changed, 37 insertions, 28 deletions
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index ddac2b9e..9d4f43ce 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -939,25 +939,31 @@
if(!isNewBundle) {
- NSError *readError = nil;
- NSString *convError = nil;
- NSPropertyListFormat format;
NSDictionary *cmdData = nil;
- NSData *pData = [NSData dataWithContentsOfFile:cmdFilePath options:NSUncachedRead error:&readError];
- cmdData = [[NSPropertyListSerialization propertyListFromData:pData
- mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
- if(!cmdData || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
- NSLog(@"“%@” file couldn't be read.", cmdFilePath);
- NSBeep();
- if (cmdData) [cmdData release];
- return NO;
- } else {
- // Check for changes and return if no changes are found
- if([[saveDict description] isEqualToString:[cmdData description]])
- return YES;
- if([cmdData objectForKey:SPBundleFileIsDefaultBundleKey])
- [saveDict setObject:@YES forKey:SPBundleFileDefaultBundleWasModifiedKey];
+ {
+ NSError *error = nil;
+
+ NSData *pData = [NSData dataWithContentsOfFile:cmdFilePath options:NSUncachedRead error:&error];
+
+ cmdData = [[NSPropertyListSerialization propertyListWithData:pData
+ options:NSPropertyListImmutable
+ format:NULL
+ error:&error] retain];
+
+ if(!cmdData || error) {
+ NSLog(@"“%@” file couldn't be read. (error=%@)", cmdFilePath, error);
+ NSBeep();
+ if (cmdData) [cmdData release];
+ return NO;
+ }
}
+
+ // Check for changes and return if no changes are found
+ if([[saveDict description] isEqualToString:[cmdData description]])
+ return YES;
+ if([cmdData objectForKey:SPBundleFileIsDefaultBundleKey])
+ [saveDict setObject:@YES forKey:SPBundleFileDefaultBundleWasModifiedKey];
+
if (cmdData) [cmdData release];
}
@@ -966,7 +972,6 @@
[saveDict writeToFile:cmdFilePath atomically:YES];
return YES;
-
}
/**
@@ -1642,21 +1647,25 @@
for(NSString* bundle in foundBundles) {
if(![[[bundle pathExtension] lowercaseString] isEqualToString:[SPUserBundleFileExtension lowercaseString]]) continue;
- NSError *readError = nil;
- NSString *convError = nil;
- NSPropertyListFormat format;
NSDictionary *cmdData = nil;
+ NSError *readError = nil;
+
NSString *infoPath = [NSString stringWithFormat:@"%@/%@/%@", bundlePath, bundle, SPBundleFileName];
NSData *pData = [NSData dataWithContentsOfFile:infoPath options:NSUncachedRead error:&readError];
-
- cmdData = [[NSPropertyListSerialization propertyListFromData:pData
- mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
-
- if(!cmdData || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
- NSLog(@"“%@/%@” file couldn't be read.", bundle, SPBundleFileName);
+
+ if(pData && !error) {
+ cmdData = [[NSPropertyListSerialization propertyListWithData:pData
+ options:NSPropertyListImmutable
+ format:NULL
+ error:&readError] retain];
+ }
+
+ if(!cmdData || readError) {
+ NSLog(@"“%@/%@” file couldn't be read. (error=%@)", bundle, SPBundleFileName, readError);
NSBeep();
if (cmdData) [cmdData release];
- } else {
+ }
+ else {
if([cmdData objectForKey:SPBundleFileNameKey] && [[cmdData objectForKey:SPBundleFileNameKey] length] && [cmdData objectForKey:SPBundleFileScopeKey])
{
NSMutableDictionary *bundleCommand = [NSMutableDictionary dictionary];