aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFavoritesController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPFavoritesController.m')
-rw-r--r--Source/SPFavoritesController.m6
1 files changed, 4 insertions, 2 deletions
diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m
index e883d876..9ecee454 100644
--- a/Source/SPFavoritesController.m
+++ b/Source/SPFavoritesController.m
@@ -380,15 +380,16 @@ static SPFavoritesController *sharedFavoritesController = nil;
// to create the plist data. This is done before file changes as it can sometimes
// be terminated during shutdown.
NSDictionary *dictionary = [NSDictionary dictionaryWithObject:data forKey:SPFavoritesRootKey];
+
NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:dictionary
format:NSPropertyListXMLFormat_v1_0
errorDescription:&errorString];
if (errorString) {
NSLog(@"Error converting favorites data to plist format: %@", errorString);
+
[errorString release];
}
-
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *dataPath = [fileManager applicationSupportDirectoryForSubDirectory:SPDataSupportFolder error:&error];
@@ -430,13 +431,14 @@ static SPFavoritesController *sharedFavoritesController = nil;
// Restore the original data file
error = nil;
+
[fileManager moveItemAtPath:favoritesBackupFile toPath:favoritesFile error:&error];
+
if (error) {
NSLog(@"Could not restore backup; favorites.plist left renamed as %@ due to error (%@)", favoritesBackupFile, [error localizedDescription]);
}
}
else {
-
// Remove the original backup
[fileManager removeItemAtPath:favoritesBackupFile error:NULL];
}