project_files/HedgewarsMobile/Classes/MainMenuViewController.m
changeset 3891 f8f0d0ceb19c
parent 3884 d7479079a8a8
child 3893 568bfd083465
equal deleted inserted replaced
3889:f7d6834a54fe 3891:f8f0d0ceb19c
    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];