From d37764cdea753d0d1fac4eb8f52338ffdd94889c Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Tue, 19 Aug 2014 21:24:06 +0000 Subject: [PATCH] OS X: make the memory code movement code work. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@91263 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/Source/PcsxrController.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/macosx/Source/PcsxrController.m b/macosx/Source/PcsxrController.m index ba2cb774..37b49179 100644 --- a/macosx/Source/PcsxrController.m +++ b/macosx/Source/PcsxrController.m @@ -674,7 +674,7 @@ otherblock();\ 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]) { + if (!wasFinderLaunch && [oldMemoryURL checkResourceIsReachableAndReturnError:NULL]) { NSDictionary *mcds = @{@"Mcd1": [defaults URLForKey:@"Mcd1"], @"Mcd2": [defaults URLForKey:@"Mcd2"]}; for (NSString *key in mcds) { @@ -686,12 +686,16 @@ otherblock();\ NSMutableArray *newPath = [[memoryURL pathComponents] mutableCopy]; [newPath addObjectsFromArray:barePath]; NSURL *replacementPath = [NSURL fileURLWithPathComponents:newPath]; - //if ([manager moveItemAtURL:obj toURL:replacementPath error:NULL]) { + if ([manager moveItemAtURL:obj toURL:replacementPath error:NULL]) { [defaults setURL:replacementPath forKey:key]; - //} + } } } - [manager moveItemAtURL:oldMemoryURL toURL:memoryURL error:NULL]; + NSArray *memoryFiles = [manager contentsOfDirectoryAtURL:oldMemoryURL includingPropertiesForKeys:@[] options:0 error:NULL]; + for (NSURL *memLoc in memoryFiles) { + [manager moveItemAtURL:memLoc toURL:[memoryURL URLByAppendingPathComponent:[memLoc lastPathComponent]] error:NULL]; + } + [manager removeItemAtURL:oldMemoryURL error:NULL]; [defaults setBool:YES forKey:@"DidMoveMemoryObjects"]; }