Skip to content

Commit

Permalink
Use NSFileManager interface for DMG unarchive only for 10.7+. On 10.6…
Browse files Browse the repository at this point in the history
…, [NSFileManager copyItemAtPath:toPath:error:] can fail with "Argument list too long" if the app bundle contains too many files.

The switch to NSFileManager was only required for 10.7 anyway, 10.6 always worked fine.
  • Loading branch information
sinbad committed Jun 28, 2012
1 parent 9662452 commit 91ac917
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SUDiskImageUnarchiver.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ - (void)extractDMG
mountedSuccessfully = YES;

// Now that we've mounted it, we need to copy out its contents.
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
// On 10.6 and later we don't want to use the File Manager API and instead want to use NSFileManager (fixes #827357).
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
// On 10.7 and later we don't want to use the File Manager API and instead want to use NSFileManager (fixes #827357).
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
NSError *error = nil;
NSArray *contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
Expand All @@ -91,7 +91,7 @@ - (void)extractDMG

if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
{
SULog(@"Couldn't copy item: %@", error);
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
goto reportError;
}
}
Expand Down

0 comments on commit 91ac917

Please sign in to comment.