Skip to content

Commit

Permalink
Update prefs migration for new config file location.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrynearson committed Dec 22, 2011
1 parent 492a022 commit 306a940
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions platforms/osx/TileMillAppDelegate.m
Expand Up @@ -79,7 +79,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification

// v0.7.2+ migrations from defaults to dotfile (see #1015)
//
if ( ! [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/.tilemill.json", NSHomeDirectory()]])
if ( ! [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/.tilemill/config.json", NSHomeDirectory()]])
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray *options = [NSMutableArray array];
Expand All @@ -106,7 +106,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
[contents appendString:[options componentsJoinedByString:@",\n "]];
[contents appendString:@"\n}\n"];

[contents writeToFile:[NSString stringWithFormat:@"%@/.tilemill.json", NSHomeDirectory()]
if ( ! [[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/.tilemill", NSHomeDirectory()]])
{
[[NSFileManager defaultManager] createDirectoryAtPath:[NSString stringWithFormat:@"%@/.tilemill", NSHomeDirectory()] withIntermediateDirectories:YES attributes:nil error:nil];
}

[contents writeToFile:[NSString stringWithFormat:@"%@/.tilemill/config.json", NSHomeDirectory()]
atomically:YES
encoding:NSUTF8StringEncoding
error:NULL];
Expand Down

0 comments on commit 306a940

Please sign in to comment.