Revision: 7497
http://skim-app.svn.sourceforge.net/skim-app/?rev=7497&view=rev
Author: hofman
Date: 2011-09-21 10:17:22 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
Replace core filemanager function back to NSFileManager methods using a local
copy, because FSCopyObjectSync has a crashing bug on Lion, and we don't run
this on 10.4 anyway anymore.
Modified Paths:
--------------
trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m
trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m
trunk/vendorsrc/andymatuschak/Sparkle/Sparkle.xcodeproj/project.pbxproj
Modified: trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m
===================================================================
--- trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m
2011-09-18 12:05:39 UTC (rev 7496)
+++ trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m
2011-09-21 10:17:22 UTC (rev 7497)
@@ -9,7 +9,6 @@
#import "SUDiskImageUnarchiver.h"
#import "SUUnarchiver_Private.h"
#import "NTSynchronousTask.h"
-#import <CoreServices/CoreServices.h>
@implementation SUDiskImageUnarchiver
@@ -28,10 +27,12 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
BOOL mountedSuccessfully = NO;
+ // get a local copy of NSFileManager because this is running from a
secondary thread
+ NSFileManager *fm = [[[NSFileManager alloc] init] autorelease];
+
// get a unique mount point path
NSString *mountPointName = nil;
NSString *mountPoint = nil;
- FSRef tmpRef;
do
{
CFUUIDRef uuid = CFUUIDCreate(NULL);
@@ -44,7 +45,7 @@
#endif
mountPoint = [@"/Volumes"
stringByAppendingPathComponent:mountPointName];
}
- while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint
fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef,
NULL));
+ while ([fm fileExistsAtPath:mountPoint]);
NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath,
@"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil];
// set up a pipe and push "yes" (y works too), this will accept any
license agreement crap
@@ -56,16 +57,21 @@
mountedSuccessfully = YES;
// Now that we've mounted it, we need to copy out its contents.
- FSRef srcRef, dstRef;
- OSErr err;
- err = FSPathMakeRef((UInt8 *)[mountPoint fileSystemRepresentation],
&srcRef, NULL);
- if (err != noErr) goto reportError;
- err = FSPathMakeRef((UInt8 *)[[archivePath
stringByDeletingLastPathComponent] fileSystemRepresentation], &dstRef, NULL);
- if (err != noErr) goto reportError;
+ NSString *targetPath = [[archivePath stringByDeletingLastPathComponent]
stringByAppendingPathComponent:mountPointName];
+ if (![fm createDirectoryAtPath:targetPath withIntermediateDirectories:YES
attributes:nil error:NULL]) goto reportError;
+
+ // We can't just copyPath: from the volume root because that always fails.
Seems to be a bug.
+
+ id subpathEnumerator = [[fm contentsOfDirectoryAtPath:mountPoint
error:NULL] objectEnumerator], currentSubpath;
+ while ((currentSubpath = [subpathEnumerator nextObject]))
+ {
+ NSString *currentFullPath = [mountPoint
stringByAppendingPathComponent:currentSubpath];
+ // Don't bother trying (and failing) to copy out files we can't read.
That's not going to be the app anyway.
+ if (![fm isReadableFileAtPath:currentFullPath]) continue;
+ if (![fm copyItemAtPath:currentFullPath toPath:[targetPath
stringByAppendingPathComponent:currentSubpath] error:NULL])
+ goto reportError;
+ }
- err = FSCopyObjectSync(&srcRef, &dstRef, (CFStringRef)mountPointName,
NULL, kFSFileOperationSkipSourcePermissionErrors);
- if (err != noErr) goto reportError;
-
[self performSelectorOnMainThread:@selector(_notifyDelegateOfSuccess)
withObject:nil waitUntilDone:NO];
goto finally;
Modified: trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m
===================================================================
--- trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m
2011-09-18 12:05:39 UTC (rev 7496)
+++ trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m
2011-09-21 10:17:22 UTC (rev 7497)
@@ -9,7 +9,6 @@
#import "Sparkle.h"
#import "SUPlainInstallerInternals.h"
-#import <CoreServices/CoreServices.h>
#import <Security/Security.h>
#import <sys/stat.h>
#import <sys/wait.h>
@@ -194,11 +193,10 @@
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst
temporaryName:(NSString *)tmp error:(NSError **)error
{
- FSRef srcRef, dstRef, targetRef, movedRef;
- OSErr err;
-
- err = FSPathMakeRefWithOptions((UInt8 *)[dst fileSystemRepresentation],
kFSPathMakeRefDoNotFollowLeafSymlink, &dstRef, NULL);
- if (err != noErr)
+ // get a local copy of NSFileManager because this is running from a
secondary thread
+ NSFileManager *fm = [[[NSFileManager alloc] init] autorelease];
+
+ if (![fm fileExistsAtPath:dst])
{
NSString *errorMessage = [NSString stringWithFormat:@"Couldn't
copy %@ over %@ because there is no file at %@.", src, dst, dst];
if (error != NULL)
@@ -206,41 +204,28 @@
return NO;
}
- NSString *tmpPath = [[dst stringByDeletingLastPathComponent]
stringByAppendingPathComponent:tmp];
+ NSString *tmpPath = [[dst stringByDeletingLastPathComponent]
stringByAppendingPathComponent:tmp];
- if (0 != access([dst fileSystemRepresentation], W_OK) || 0 !=
access([[dst stringByDeletingLastPathComponent] fileSystemRepresentation],
W_OK))
+ if (![fm isWritableFileAtPath:dst] || ![fm isWritableFileAtPath:[dst
stringByDeletingLastPathComponent]])
return [self _copyPathWithForcedAuthentication:src toPath:dst
temporaryPath:tmpPath error:error];
- err = FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent]
fileSystemRepresentation], &targetRef, NULL);
- if (err == noErr)
- err = FSMoveObjectSync(&dstRef, &targetRef, (CFStringRef)tmp,
&movedRef, 0);
- if (err != noErr)
+ if (![fm moveItemAtPath:dst toPath:tmpPath error:NULL])
{
if (error != NULL)
*error = [NSError errorWithDomain:SUSparkleErrorDomain
code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString
stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath]
forKey:NSLocalizedDescriptionKey]];
return NO;
}
- err = FSPathMakeRef((UInt8 *)[src fileSystemRepresentation], &srcRef,
NULL);
- if (err == noErr)
- err = FSCopyObjectSync(&srcRef, &targetRef, NULL, NULL, 0);
- if (err != noErr)
+ if (![fm copyItemAtPath:src toPath:dst error:NULL])
{
// We better move the old version back to its old location
- FSMoveObjectSync(&movedRef, &targetRef, (CFStringRef)[dst
lastPathComponent], &movedRef, 0);
+ [fm moveItemAtPath:tmpPath toPath:dst error:NULL];
if (error != NULL)
*error = [NSError errorWithDomain:SUSparkleErrorDomain
code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString
stringWithFormat:@"Couldn't copy %@ to %@.", src, dst]
forKey:NSLocalizedDescriptionKey]];
return NO;
}
// Trash the old copy of the app.
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
- if (FSMoveObjectToTrashSync == NULL)
- [self performSelectorOnMainThread:@selector(_movePathToTrash:)
withObject:tmpPath waitUntilDone:YES];
- else if (noErr != FSMoveObjectToTrashSync(&movedRef, NULL, 0))
- NSLog(@"Sparkle error: couldn't move %@ to the trash. This is
often a sign of a permissions error.", tmpPath);
-#else
- [self performSelectorOnMainThread:@selector(_movePathToTrash:)
withObject:tmpPath waitUntilDone:YES];
-#endif
+ [self performSelectorOnMainThread:@selector(_movePathToTrash:)
withObject:tmpPath waitUntilDone:YES];
// If the currently-running application is trusted, the new
// version should be trusted as well. Remove it from the
Modified:
trunk/vendorsrc/andymatuschak/Sparkle/Sparkle.xcodeproj/project.pbxproj
===================================================================
--- trunk/vendorsrc/andymatuschak/Sparkle/Sparkle.xcodeproj/project.pbxproj
2011-09-18 12:05:39 UTC (rev 7496)
+++ trunk/vendorsrc/andymatuschak/Sparkle/Sparkle.xcodeproj/project.pbxproj
2011-09-21 10:17:22 UTC (rev 7497)
@@ -89,7 +89,6 @@
61F83F720DBFE140006FDD30 /* SUBasicUpdateDriver.m in Sources */
= {isa = PBXBuildFile; fileRef = 61F83F700DBFE137006FDD30 /*
SUBasicUpdateDriver.m */; };
61F83F740DBFE141006FDD30 /* SUBasicUpdateDriver.h in Headers */
= {isa = PBXBuildFile; fileRef = 61F83F6F0DBFE137006FDD30 /*
SUBasicUpdateDriver.h */; settings = {ATTRIBUTES = (); }; };
61FA52880E2D9EA400EF58AD /* Sparkle.framework in Frameworks */
= {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework
*/; settings = {ATTRIBUTES = (Required, ); }; };
- CE5C82E010039D2C000649DC /* CoreServices.framework in
Frameworks */ = {isa = PBXBuildFile; fileRef = CE5C82DF10039D2C000649DC /*
CoreServices.framework */; };
DAAEFC9B0DA5722F0051E0D0 /* AppKit.framework in Frameworks */ =
{isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */;
};
DAAEFD4E0DA572330051E0D0 /* relaunch.m in Sources */ = {isa =
PBXBuildFile; fileRef = 613242130CD06CEF00106AA4 /* relaunch.m */; };
DAAEFD510DA572550051E0D0 /* relaunch in Resources */ = {isa =
PBXBuildFile; fileRef = DAAEFC960DA571DF0051E0D0 /* relaunch */; };
@@ -313,7 +312,6 @@
61177A1F0D1112E900749C97 /* IOKit.framework in
Frameworks */,
FAEFA2F70D94AA7500472538 /*
Foundation.framework in Frameworks */,
FAEFA2F80D94AA7900472538 /* AppKit.framework in
Frameworks */,
- CE5C82E010039D2C000649DC /*
CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit