diff --git a/iOS/GBROMManager.m b/iOS/GBROMManager.m index a1cccde..0387de7 100644 --- a/iOS/GBROMManager.m +++ b/iOS/GBROMManager.m @@ -25,6 +25,12 @@ if (!self) return nil; self.currentROM = [[NSUserDefaults standardUserDefaults] stringForKey:@"GBLastROM"]; _doneInitializing = true; + + // Pre 1.0.2 versions might have kept temp files in there incorrectly + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"GBDeletedInbox"]) { + [[NSFileManager defaultManager] removeItemAtPath:[self.localRoot stringByAppendingPathComponent:@"Inbox"] error:nil]; + [[NSUserDefaults standardUserDefaults] setBool:true forKey:@"GBDeletedInbox"]; + } return self; } @@ -195,9 +201,11 @@ [[NSFileManager defaultManager] removeItemAtPath:romFolder error:nil]; return nil; } - } + // Remove the Inbox directory if empty after import + rmdir([self.localRoot stringByAppendingPathComponent:@"Inbox"].UTF8String); + return friendlyName; } diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m index 79ca30f..dcf04c2 100644 --- a/iOS/GBViewController.m +++ b/iOS/GBViewController.m @@ -1508,7 +1508,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response [url startAccessingSecurityScopedResource]; [GBROMManager sharedManager].currentROM = [[GBROMManager sharedManager] importROM:url.path - keepOriginal:![url.path hasPrefix:tempDir] && !inPlace]; + keepOriginal:![url.path hasPrefix:tempDir] && inPlace]; [url stopAccessingSecurityScopedResource]; } return true; @@ -1521,7 +1521,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response } [url startAccessingSecurityScopedResource]; [[GBROMManager sharedManager] importROM:url.path - keepOriginal:![url.path hasPrefix:tempDir] && !inPlace]; + keepOriginal:![url.path hasPrefix:tempDir] && inPlace]; [url stopAccessingSecurityScopedResource]; } [self openLibrary];