OS X: Move the default folder for the memory cards to within the user's Documents folder.

git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@91262 e17a0e51-4ae3-4d35-97c3-1a29b211df97
This commit is contained in:
SND\MaddTheSane_cp 2014-08-19 21:04:32 +00:00
parent 7a2bc23c54
commit 9d66a1ec68
6 changed files with 50 additions and 11 deletions

View File

@ -428,7 +428,7 @@
2B4DE98D05FF9307003EFEF0 /* PluginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginController.h; sourceTree = "<group>"; };
2B4DE98E05FF9307003EFEF0 /* PluginController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginController.m; sourceTree = "<group>"; usesTabs = 1; };
2B75FD3C051C56D200D12034 /* PcsxrController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PcsxrController.h; sourceTree = "<group>"; };
2B75FD3D051C56D200D12034 /* PcsxrController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PcsxrController.m; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
2B75FD3D051C56D200D12034 /* PcsxrController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = PcsxrController.m; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
2B75FD4A051C8A7400D12034 /* ConfigurationController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ConfigurationController.h; sourceTree = "<group>"; };
2B75FD4B051C8A7400D12034 /* ConfigurationController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ConfigurationController.m; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
2B976C00074C14B4007C050A /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = "<absolute>"; };

View File

@ -75,6 +75,8 @@
"Error opening file" = "Error opening file.";
"Unable to open %@: %@" = "Unable to open %1$@: %2$@";
"PSX Mem moved Desc" = "Memory Cards Moved";
"Psx Mem Moved" = "The memory card folder has been moved to your \"Documents\" folder\n\nThis message will not show up again.";
//Memory card management
"Format Card" = "Format Card";

View File

@ -77,6 +77,8 @@
"Error opening file" = "Érreur en ouvrant le fichier.";
"Unable to open %@: %@" = "Unable to open %1$@: %2$@";
//"PSX Mem moved Desc" = "Memory Cards Moved";
//"Psx Mem Moved" = "The memory card folder has been moved to your \"Documents\" folder\n\nThis message will not show up again.";
//Memory card management
"Format Card" = "Formater cette carte mémoire ?"; //Trim this down

View File

@ -77,6 +77,8 @@
"Error opening file" = "Hiba a fájl megnyitása közben";
//"Unable to open %@: %@" = "Unable to open %1$@: %2$@";
//"PSX Mem moved Desc" = "Memory Cards Moved";
//"Psx Mem Moved" = "The memory card folder has been moved to your \"Documents\" folder\n\nThis message will not show up again.";
//Memory card management
"Format Card" = "Kártya formázása";

View File

@ -77,6 +77,8 @@
"Error opening file" = "文件打开错误.";
"Unable to open %@: %@" = "不能打开 %1$@: %2$@";
//"PSX Mem moved Desc" = "Memory Cards Moved";
//"Psx Mem Moved" = "The memory card folder has been moved to your \"Documents\" folder\n\nThis message will not show up again.";
//Memory card management
"Format Card" = "格式化记忆卡";

View File

@ -406,6 +406,14 @@ static void PSXDiscAppearedCallback(DADiskRef disk, void *context)
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
self.skipFiles = nil;
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DidMoveMemoryObjects"]) {
NSAlert *memDidMove = [[NSAlert alloc] init];
memDidMove.messageText = NSLocalizedString(@"PSX Mem moved Desc", @"Playstation Cards did move");
memDidMove.informativeText = NSLocalizedString(@"Psx Mem Moved", @"Playstation Cards did move");
memDidMove.alertStyle = NSInformationalAlertStyle;
[memDidMove runModal];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DidMoveMemoryObjects"];
}
}
static void ParseErrorStr(NSString *errStr)
@ -663,7 +671,29 @@ otherblock();\
{
NSFileManager *manager = [NSFileManager defaultManager];
NSURL *memoryURL = [[[manager URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL] URLByAppendingPathComponent:@"Pcsxr"] URLByAppendingPathComponent:@"Memory Cards"];
NSURL *oldMemoryURL = [[[manager URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL] URLByAppendingPathComponent:@"Pcsxr"] URLByAppendingPathComponent:@"Memory Cards"];
NSURL *memoryURL = [[[manager URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL] URLByAppendingPathComponent:@"Pcsxr"] URLByAppendingPathComponent:@"Memory Cards"];
if (([[[NSProcessInfo processInfo] arguments] count] > 1 && !wasFinderLaunch) && [oldMemoryURL checkResourceIsReachableAndReturnError:NULL]) {
NSDictionary *mcds = @{@"Mcd1": [defaults URLForKey:@"Mcd1"],
@"Mcd2": [defaults URLForKey:@"Mcd2"]};
for (NSString *key in mcds) {
NSURL *obj = mcds[key];
NSString *dirPath = [obj.path stringByStandardizingPath];
NSString *oldDirPath = [oldMemoryURL.path stringByStandardizingPath];
if ([dirPath hasPrefix:oldDirPath]) {
NSArray *barePath = [[dirPath stringByReplacingOccurrencesOfString:oldDirPath withString:@""] pathComponents];
NSMutableArray *newPath = [[memoryURL pathComponents] mutableCopy];
[newPath addObjectsFromArray:barePath];
NSURL *replacementPath = [NSURL fileURLWithPathComponents:newPath];
//if ([manager moveItemAtURL:obj toURL:replacementPath error:NULL]) {
[defaults setURL:replacementPath forKey:key];
//}
}
}
[manager moveItemAtURL:oldMemoryURL toURL:memoryURL error:NULL];
[defaults setBool:YES forKey:@"DidMoveMemoryObjects"];
}
str = [[[defaults URLForKey:@"Mcd1"] path] fileSystemRepresentation];
if (str) {
@ -745,11 +775,12 @@ otherblock();\
const char *str;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = @{@"NoDynarec": @YES,
@"AutoDetectVideoType": @YES,
@"UseHLE": @NO,
@"PauseInBackground": @YES,
@"Widescreen": @NO,
@"NetPlay": @NO};
@"AutoDetectVideoType": @YES,
@"UseHLE": @NO,
@"PauseInBackground": @YES,
@"Widescreen": @NO,
@"NetPlay": @NO,
@"DidMoveMemoryObjects": @NO};
[defaults registerDefaults:appDefaults];
@ -761,7 +792,7 @@ otherblock();\
@"PluginSIO1": [NSValue valueWithPointer:Config.Sio1]};
prefURLKeys = @{@"Mcd1": [NSValue valueWithPointer:Config.Mcd1],
@"Mcd2": [NSValue valueWithPointer:Config.Mcd2]};
@"Mcd2": [NSValue valueWithPointer:Config.Mcd2]};
prefByteKeys = @{@"NoXaAudio": [NSValue valueWithPointer:&Config.Xa],
@"SioIrqAlways": [NSValue valueWithPointer:&Config.SioIrq],
@ -781,19 +812,19 @@ otherblock();\
NSURL *supportURL = [manager URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL];
if(supportURL != nil) {
NSURL *PcsxrAppSupport;
NSURL *PcsxrAppSupport = [supportURL URLByAppendingPathComponent:@"Pcsxr"];
NSURL *pcsxrDocument = [[manager URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL] URLByAppendingPathComponent:@"Pcsxr"];
NSURL *MemCardPath;
NSURL *url;
BOOL dir;
PcsxrAppSupport = [supportURL URLByAppendingPathComponent:@"Pcsxr"];
// create them if needed
url = [PcsxrAppSupport URLByAppendingPathComponent:@"Bios"];
if (![url checkResourceIsReachableAndReturnError:NULL])
[manager createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:NULL];
MemCardPath = [PcsxrAppSupport URLByAppendingPathComponent:@"Memory Cards"];
MemCardPath = [pcsxrDocument URLByAppendingPathComponent:@"Memory Cards"];
url = MemCardPath;
if (![url checkResourceIsReachableAndReturnError:NULL])
[manager createDirectoryAtURL:url withIntermediateDirectories:YES attributes:nil error:NULL];