equal
deleted
inserted
replaced
74 if (doCreateFiles == YES) { |
74 if (doCreateFiles == YES) { |
75 NSError *err = nil; |
75 NSError *err = nil; |
76 NSString *directoryToCheck, *fileToCheck, *fileToUpdate; |
76 NSString *directoryToCheck, *fileToCheck, *fileToUpdate; |
77 DLog(@"Creating necessary files"); |
77 DLog(@"Creating necessary files"); |
78 |
78 |
|
79 // create an empty saves directory by deleting the previous one (saves are incompatible between releases) |
|
80 if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()]) |
|
81 [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL]; |
|
82 [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL]; |
|
83 |
79 // if the settings file is already present, we merge current preferences with the update |
84 // if the settings file is already present, we merge current preferences with the update |
80 directoryToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir]; |
85 directoryToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir]; |
81 if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) { |
86 if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) { |
82 NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()]; |
87 NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:SETTINGS_FILE()]; |
83 NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:directoryToCheck]; |
88 NSMutableDictionary *update = [[NSMutableDictionary alloc] initWithContentsOfFile:directoryToCheck]; |