# HG changeset patch # User antonc27 # Date 1444864403 -7200 # Node ID 279ed2931be82456ce6bbc1e7806f7fe7e292774 # Parent 2e80c98618189699895ae665e5c5bef151132461 - Fix for wrong path of restored game Note: http://stackoverflow.com/questions/25884382/ios-8-bundle-path-changes diff -r 2e80c9861818 -r 279ed2931be8 project_files/HedgewarsMobile/Classes/RestoreViewController.m --- 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"];