- Fix for wrong path of restored game
Note: http://stackoverflow.com/questions/25884382/ios-8-bundle-path-changes
--- 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"];