Fixed a bug where ROMs were moved instead of copied and vice versa, fixes #701

This commit is contained in:
Lior Halphon 2025-06-28 15:04:14 +03:00
parent d52a50353d
commit 15588a065f
2 changed files with 11 additions and 3 deletions

View File

@ -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;
}

View File

@ -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];