Revision: 7498
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7498&view=rev
Author:   hofman
Date:     2011-09-21 11:20:52 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
support 10.4 in principle in code for consistency

Modified Paths:
--------------
    trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m
    trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstaller.m
    trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m

Modified: trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m
===================================================================
--- trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m       
2011-09-21 10:17:22 UTC (rev 7497)
+++ trunk/vendorsrc/andymatuschak/Sparkle/SUDiskImageUnarchiver.m       
2011-09-21 11:20:52 UTC (rev 7498)
@@ -17,18 +17,17 @@
        return [[path pathExtension] isEqualToString:@"dmg"];
 }
 
-- (void)start
-{
-       [NSThread detachNewThreadSelector:@selector(_extractDMG) toTarget:self 
withObject:nil];
-}
-
 - (void)_extractDMG
 {              
        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];
+    NSFileManager *fm;
+    if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4)
+        fm = [[[NSFileManager alloc] init] autorelease];
+    else
+        fm = [NSFileManager defaultManager];
     
        // get a unique mount point path
        NSString *mountPointName = nil;
@@ -58,17 +57,31 @@
        
        // Now that we've mounted it, we need to copy out its contents.
     NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] 
stringByAppendingPathComponent:mountPointName];
-    if (![fm createDirectoryAtPath:targetPath withIntermediateDirectories:YES 
attributes:nil error:NULL]) goto reportError;
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
+    if (![fm createDirectoryAtPath:targetPath withIntermediateDirectories:YES 
attributes:nil error:NULL])
+#else
+    if (![fm createDirectoryAtPath:targetPath attributes:nil])
+#endif
+        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;
+    id subpathEnumerator, currentSubpath;
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
+    subpathEnumerator = [[fm contentsOfDirectoryAtPath:mountPoint error:NULL] 
objectEnumerator];
+#else
+    subpathEnumerator = [[fm directoryContentsAtPath:mountPoint] 
objectEnumerator];
+#endif
     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 MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
         if (![fm copyItemAtPath:currentFullPath toPath:[targetPath 
stringByAppendingPathComponent:currentSubpath] error:NULL])          
+#else
+        if (![fm copyPath:currentFullPath toPath:[targetPath 
stringByAppendingPathComponent:currentSubpath] handler:nil])       
+#endif
             goto reportError;   
     }
        
@@ -84,6 +97,14 @@
        [pool drain];
 }
 
+- (void)start
+{
+    if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4)
+        [NSThread detachNewThreadSelector:@selector(_extractDMG) toTarget:self 
withObject:nil];
+    else
+        [self _extractDMG];
+}
+
 + (void)load
 {
        [self _registerImplementation:self];

Modified: trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstaller.m
===================================================================
--- trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstaller.m    2011-09-21 
10:17:22 UTC (rev 7497)
+++ trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstaller.m    2011-09-21 
11:20:52 UTC (rev 7498)
@@ -55,7 +55,7 @@
     NSString *targetPath = [host bundlePath];
     NSString *tempName = [self temporaryNameForPath:targetPath];
        NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, 
SUInstallerPathKey, targetPath, SUInstallerTargetPathKey, tempName, 
SUInstallerTempNameKey, host, SUInstallerHostKey, delegate, 
SUInstallerDelegateKey, nil];
-       if (synchronously)
+       if (synchronously || floor(NSAppKitVersionNumber) <= 
NSAppKitVersionNumber10_4)
                [self _performInstallationWithInfo:info];
        else
                [NSThread 
detachNewThreadSelector:@selector(_performInstallationWithInfo:) toTarget:self 
withObject:info];

Modified: trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m
===================================================================
--- trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m   
2011-09-21 10:17:22 UTC (rev 7497)
+++ trunk/vendorsrc/andymatuschak/Sparkle/SUPlainInstallerInternals.m   
2011-09-21 11:20:52 UTC (rev 7498)
@@ -194,7 +194,11 @@
 + (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst 
temporaryName:(NSString *)tmp error:(NSError **)error
 {
     // get a local copy of NSFileManager because this is running from a 
secondary thread
-    NSFileManager *fm = [[[NSFileManager alloc] init] autorelease];
+    NSFileManager *fm;
+    if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4)
+        fm = [[[NSFileManager alloc] init] autorelease];
+    else
+        fm = [NSFileManager defaultManager];
     
        if (![fm fileExistsAtPath:dst])
        {
@@ -209,16 +213,28 @@
     if (![fm isWritableFileAtPath:dst] || ![fm isWritableFileAtPath:[dst 
stringByDeletingLastPathComponent]])
                return [self _copyPathWithForcedAuthentication:src toPath:dst 
temporaryPath:tmpPath error:error];
        
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
        if (![fm moveItemAtPath:dst toPath:tmpPath error:NULL])
+#else
+       if (![fm movePath:dst toPath:tmpPath handler:nil])
+#endif
        {
                if (error != NULL)
                        *error = [NSError errorWithDomain:SUSparkleErrorDomain 
code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString 
stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] 
forKey:NSLocalizedDescriptionKey]];
                return NO;                      
        }
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
        if (![fm copyItemAtPath:src toPath:dst error:NULL])
+#else
+       if (![fm copyPath:src toPath:dst handler:nil])
+#endif
        {
                // We better move the old version back to its old location
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
                [fm moveItemAtPath:tmpPath toPath:dst error:NULL];
+#else
+               [fm movePath:tmpPath toPath:dst handler:nil];
+#endif
                if (error != NULL)
                        *error = [NSError errorWithDomain:SUSparkleErrorDomain 
code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString 
stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] 
forKey:NSLocalizedDescriptionKey]];
                return NO;                      

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

Reply via email to