summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-08-19 21:04:32 +0000
committerSND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-08-19 21:04:32 +0000
commit9d66a1ec68ac6ddfd5b455ae505ae7ea7f939aa5 (patch)
tree817f90942199a2b9bb7eec7445b3a47214a4b2f9
parent7a2bc23c5401fe689bab659b46dd6443f1f8a744 (diff)
downloadpcsxr-9d66a1ec68ac6ddfd5b455ae505ae7ea7f939aa5.tar.gz
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
-rw-r--r--macosx/Pcsxr.xcodeproj/project.pbxproj2
-rw-r--r--macosx/Resources/en.lproj/Localizable.strings2
-rw-r--r--macosx/Resources/fr.lproj/Localizable.strings2
-rw-r--r--macosx/Resources/hu.lproj/Localizable.strings2
-rw-r--r--macosx/Resources/zh-Hans.lproj/Localizable.strings2
-rw-r--r--macosx/Source/PcsxrController.m51
6 files changed, 50 insertions, 11 deletions
diff --git a/macosx/Pcsxr.xcodeproj/project.pbxproj b/macosx/Pcsxr.xcodeproj/project.pbxproj
index 820f2555..398456c3 100644
--- a/macosx/Pcsxr.xcodeproj/project.pbxproj
+++ b/macosx/Pcsxr.xcodeproj/project.pbxproj
@@ -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>"; };
diff --git a/macosx/Resources/en.lproj/Localizable.strings b/macosx/Resources/en.lproj/Localizable.strings
index 61ded82a..af3d0e8d 100644
--- a/macosx/Resources/en.lproj/Localizable.strings
+++ b/macosx/Resources/en.lproj/Localizable.strings
@@ -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";
diff --git a/macosx/Resources/fr.lproj/Localizable.strings b/macosx/Resources/fr.lproj/Localizable.strings
index 12c544d6..15bbc906 100644
--- a/macosx/Resources/fr.lproj/Localizable.strings
+++ b/macosx/Resources/fr.lproj/Localizable.strings
@@ -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
diff --git a/macosx/Resources/hu.lproj/Localizable.strings b/macosx/Resources/hu.lproj/Localizable.strings
index d3c9de52..e88aa559 100644
--- a/macosx/Resources/hu.lproj/Localizable.strings
+++ b/macosx/Resources/hu.lproj/Localizable.strings
@@ -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";
diff --git a/macosx/Resources/zh-Hans.lproj/Localizable.strings b/macosx/Resources/zh-Hans.lproj/Localizable.strings
index e13feb42..beea96da 100644
--- a/macosx/Resources/zh-Hans.lproj/Localizable.strings
+++ b/macosx/Resources/zh-Hans.lproj/Localizable.strings
@@ -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" = "格式化记忆卡";
diff --git a/macosx/Source/PcsxrController.m b/macosx/Source/PcsxrController.m
index 4bdce477..ba2cb774 100644
--- a/macosx/Source/PcsxrController.m
+++ b/macosx/Source/PcsxrController.m
@@ -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];