Check to see if a BIOS file has been passed to us, and ask if the user wants to move or copy the BIOS over.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@88203 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2013-12-30 20:20:48 +00:00
parent d4da70307e
commit 618c6539e8
4 changed files with 80 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/*
/*
Localizable.strings
Pcsx
@ -100,6 +100,14 @@
"No" = "No";
"Delete" = "Delete";
//BIOS file opener
"PlayStation BIOS File" = "PlayStation BIOS File";
"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?" = "The file “%1$@\” seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?";
"BIOS_Copy" = "Copy";
"BIOS_Move" = "Move";
"BIOS Already Exists" = "BIOS Already Exists";
"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\"." = "There already exists a BIOS file at “%1$@”: not copying the file at “%2$@”.\n\nIf you do want to use the BIOS file at “%2$@”, delete the BIOS at “%1$@”.";
//not-so-general buttons
"Show Folder" = "Show Folder";

View File

@ -79,7 +79,7 @@
"Unable to open %@: %@" = "Unable to open %1$@: %2$@";
//Memory card management
"Format Card" = "Formater cette carte mémoire ?";
"Format Card" = "Formater cette carte mémoire ?"; //Trim this down
//"Free Size" = "Free Size";
//"Format" = "Format";
//"Formatting a memory card will remove all data on it.\n\nThis cannot be undone." = "Formatting a memory card will remove all data on it.\n\nThis cannot be undone.";
@ -105,6 +105,15 @@
//not-so-general buttons
//"Show Folder" = "Show Folder";
//BIOS file opener
//"PlayStation BIOS File" = "PlayStation BIOS File";
//"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?" = "The file “%1$@\” seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?";
//"BIOS_Copy" = "Copy";
//"BIOS_Move" = "Move";
//"BIOS Already Exists" = "BIOS Already Exists";
//"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\"." = "There already exists a BIOS file at “%1$@”: not copying the file at “%2$@”.\n\nIf you do want to use the BIOS file at “%2$@”, delete the BIOS at “%1$@”.";
//Mem card flags
"MemCard_Deleted" = "Supprimé";
"MemCard_Free" = "Libre";

View File

@ -105,6 +105,14 @@
//not-so-general buttons
//"Show Folder" = "Show Folder";
//BIOS file opener
//"PlayStation BIOS File" = "PlayStation BIOS File";
//"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?" = "The file “%1$@\” seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?";
//"BIOS_Copy" = "Copy";
//"BIOS_Move" = "Move";
//"BIOS Already Exists" = "BIOS Already Exists";
//"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\"." = "There already exists a BIOS file at “%1$@”: not copying the file at “%2$@”.\n\nIf you do want to use the BIOS file at “%2$@”, delete the BIOS at “%1$@”.";
//Mem card flags
"MemCard_Deleted" = "Törölve";
"MemCard_Free" = "Üres";

View File

@ -872,6 +872,7 @@ otherblock();\
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
NSFileManager *fm = [NSFileManager defaultManager];
if (skipFiles && [skipFiles count]) {
for (NSString *parsedFile in skipFiles) {
if ([filename isEqualToString:parsedFile]) {
@ -880,11 +881,62 @@ otherblock();\
}
}
if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
if (![fm fileExistsAtPath:filename]) {
NSLog(@"Nonexistant file %@ was passed to open.", filename );
return NO;
}
if ([[filename pathExtension] compare:@"bin" options:(NSCaseInsensitiveSearch | NSWidthInsensitiveSearch)]) {
NSDictionary *attrib = [fm attributesOfItemAtPath:filename error:NULL];
if ([[attrib fileType] isEqualToString:NSFileTypeRegular] && ([attrib fileSize] % (256 * 1024)) == 0 && [attrib fileSize] > 0 ) {
NSAlert *biosInfo = [NSAlert alertWithMessageText:NSLocalizedString(@"PlayStation BIOS File", @"PSX BIOS File") defaultButton:NSLocalizedString(@"BIOS_Copy", @"copy the BIOS over") alternateButton:NSLocalizedString(@"Cancel", @"Cancel") otherButton:NSLocalizedString(@"BIOS_Move", @"Move the bios over") informativeTextWithFormat:NSLocalizedString(@"The file \"%@\" seems to be a BIOS file. Do you want PCSX-R to copy it to the proper location?", @"Can we copy the BIOS?")];
biosInfo.alertStyle = NSInformationalAlertStyle;
switch ([biosInfo runModal]) {
case NSAlertFirstButtonReturn:
case NSAlertDefaultReturn:
{
NSError *theErr = nil;
NSURL *biosDirPath = [NSURL fileURLWithPath:[fm stringWithFileSystemRepresentation:Config.BiosDir length:strlen(Config.BiosDir)] isDirectory:YES];
NSURL *biosPath = [biosDirPath URLByAppendingPathComponent:[filename lastPathComponent]];
if ([biosPath checkResourceIsReachableAndReturnError:NULL]) {
NSAlert *alreadyThere = [NSAlert alertWithMessageText:NSLocalizedString(@"BIOS Already Exists", @"BIOS file already there.") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSLocalizedString(@"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\".", @"What to do"), [biosPath path], filename];
alreadyThere.alertStyle = NSCriticalAlertStyle;
[alreadyThere runModal];
return NO;
}
if (![fm copyItemAtURL:[NSURL fileURLWithPath:filename isDirectory:NO] toURL:biosPath error:&theErr]) {
[[NSAlert alertWithError:theErr] runModal];
return NO;
}
}
break;
case NSAlertThirdButtonReturn:
case NSAlertOtherReturn:
{
NSError *theErr = nil;
NSURL *biosDirPath = [NSURL fileURLWithPath:[fm stringWithFileSystemRepresentation:Config.BiosDir length:strlen(Config.BiosDir)] isDirectory:YES];
NSURL *biosPath = [biosDirPath URLByAppendingPathComponent:[filename lastPathComponent]];
if ([biosPath checkResourceIsReachableAndReturnError:NULL]) {
NSAlert *alreadyThere = [NSAlert alertWithMessageText:NSLocalizedString(@"BIOS Already Exists", @"BIOS file already there.") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:NSLocalizedString(@"There already exists a BIOS file at \"%1$@\": not copying the file at \"%2$@\".\n\nIf you do want to use the BIOS file at \"%2$@\", delete the BIOS at \"%1$@\".", @"What to do"), [biosPath path], filename];
alreadyThere.alertStyle = NSCriticalAlertStyle;
[alreadyThere runModal];
return NO;
}
if (![fm moveItemAtURL:[NSURL fileURLWithPath:filename isDirectory:NO] toURL:biosPath error:&theErr]) {
[[NSAlert alertWithError:theErr] runModal];
return NO;
}
}
break;
default:
break;
}
return YES;
}
}
NSError *err = nil;
NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename error:&err];
if (err) {