project_files/HedgewarsMobile/Classes/MainMenuViewController.m
changeset 3891 f8f0d0ceb19c
parent 3884 d7479079a8a8
child 3893 568bfd083465
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Sun Sep 19 22:56:53 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Wed Sep 22 01:10:20 2010 +0200
@@ -76,6 +76,11 @@
         NSString *directoryToCheck, *fileToCheck, *fileToUpdate;
         DLog(@"Creating necessary files");
         
+        // create an empty saves directory by deleting the previous one (saves are incompatible between releases)
+        if ([[NSFileManager defaultManager] fileExistsAtPath:SAVES_DIRECTORY()])
+            [[NSFileManager defaultManager] removeItemAtPath:SAVES_DIRECTORY() error:NULL];
+        [[NSFileManager defaultManager] createDirectoryAtPath:SAVES_DIRECTORY() withIntermediateDirectories:NO attributes:nil error:NULL];
+        
         // if the settings file is already present, we merge current preferences with the update
         directoryToCheck = [NSString stringWithFormat:@"%@/Settings/settings.plist",resDir];
         if ([[NSFileManager defaultManager] fileExistsAtPath:SETTINGS_FILE()]) {