aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPPreferencesUpgrade.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-11-11 21:55:18 +0000
committerstuconnolly <stuart02@gmail.com>2010-11-11 21:55:18 +0000
commit18167b0fa0d58aaf12490c34a663fa661be8ec3e (patch)
tree57028df964c524dbd442d273091f5996770b10d1 /Source/SPPreferencesUpgrade.m
parente7afbbbfa7e36146acae973d14a51faf9fbcf5ec (diff)
downloadsequelpro-18167b0fa0d58aaf12490c34a663fa661be8ec3e.tar.gz
sequelpro-18167b0fa0d58aaf12490c34a663fa661be8ec3e.tar.bz2
sequelpro-18167b0fa0d58aaf12490c34a663fa661be8ec3e.zip
Make sure the root favorite has a name key and value. Also, update string files.
Diffstat (limited to 'Source/SPPreferencesUpgrade.m')
-rw-r--r--Source/SPPreferencesUpgrade.m10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m
index 081be36a..7b1c31cf 100644
--- a/Source/SPPreferencesUpgrade.m
+++ b/Source/SPPreferencesUpgrade.m
@@ -305,6 +305,7 @@ void SPMigrateConnectionFavoritesData(void)
{
NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *dataPath = [fileManager applicationSupportDirectoryForSubDirectory:SPDataSupportFolder error:&error];
@@ -316,10 +317,11 @@ void SPMigrateConnectionFavoritesData(void)
NSString *favoritesFile = [dataPath stringByAppendingPathComponent:SPFavoritesDataFile];
// Only proceed if the new favorites plist doesn't already exist
- if (![fileManager fileExistsAtPath:favoritesFile]) {
- NSDictionary *newFavorites = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObject:[[NSUserDefaults standardUserDefaults] objectForKey:SPFavorites] forKey:SPFavoriteChildrenKey] forKey:SPFavoritesRootKey];
+ if (![fileManager fileExistsAtPath:favoritesFile]) {
+
+ NSDictionary *newFavorites = [NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Favorites", @"favorites label"), SPFavoritesGroupNameKey, [prefs objectForKey:SPFavorites], SPFavoriteChildrenKey, nil] forKey:SPFavoritesRootKey];
- NSError *error = nil;
+ error = nil;
NSString *errorString = nil;
NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:newFavorites
@@ -333,7 +335,7 @@ void SPMigrateConnectionFavoritesData(void)
}
else {
// Only uncomment when migration is complete
- //[[NSUserDefaults standardUserDefaults] removeObjectForKey:SPFavorites];
+ //[prefs removeObjectForKey:SPFavorites];
}
}
else if (errorString) {