project_files/HedgewarsMobile/Classes/RestoreViewController.m
branchios-revival
changeset 11211 279ed2931be8
parent 11209 9fd7b8d3cf4d
child 11236 0425d60cd046
--- a/project_files/HedgewarsMobile/Classes/RestoreViewController.m	Wed Oct 14 21:25:49 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/RestoreViewController.m	Thu Oct 15 01:13:23 2015 +0200
@@ -38,7 +38,14 @@
     if (theButton.tag != 0) {
         [[AudioManagerController mainManager] playClickSound];
         [GameInterfaceBridge registerCallingController:self.presentingViewController];
-        [GameInterfaceBridge startSaveGame:[[NSUserDefaults standardUserDefaults] objectForKey:@"savedGamePath"]];
+        
+        // Since iOS 8, the file system layout of app containers has changed.
+        // So, we must rely now on saved game filename, not full path.
+        NSString *oldSavedGamePath = [[NSUserDefaults standardUserDefaults] objectForKey:@"savedGamePath"];
+        NSString *savedGameFile = [oldSavedGamePath lastPathComponent];
+        NSString *newSavedGamePath = [NSString stringWithFormat:@"%@%@", SAVES_DIRECTORY(), savedGameFile];
+        
+        [GameInterfaceBridge startSaveGame:newSavedGamePath];
     } else {
         [[AudioManagerController mainManager] playBackSound];
         [defaults setObject:@"" forKey:@"savedGamePath"];