Merge lp:~august-joki/sparkle/snow-leopard into lp:sparkle

Proposed by august
Status: Merged
Merged at revision: 352
Proposed branch: lp:~august-joki/sparkle/snow-leopard
Merge into: lp:sparkle
Diff against target: None lines
To merge this branch: bzr merge lp:~august-joki/sparkle/snow-leopard
Reviewer Review Type Date Requested Status
Andy Matuschak Pending
Review via email: mp+7436@code.launchpad.net
To post a comment you must log in.
Revision history for this message
august (august-joki) wrote :

File System methods have been deprecated since 10.5. Time to move to the replacement methods.

Revision history for this message
Andy Matuschak (andymatuschak) wrote :

Thanks a lot for the patch, August, but unfortunately, we still need to support Tiger, so we've gotta keep the old guys around, at least in if'd form.

I can do that myself when I get a chance (may be a bit), or I'd love to merge this in if you could handle it.

Thanks a lot!

lp:~august-joki/sparkle/snow-leopard updated
351. By August Joki <email address hidden>

added #ifdef's for Tiger support

Revision history for this message
august (august-joki) wrote :

Added the #ifdef's.

Need to review SUPlainInstallerInternals.m:240 and :250. Couldn't find where the handler was implemented.

Also the fix in the NSLog in SUHost.m is just a guess as to what it was supposed to be.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'SUAppcast.m'
--- SUAppcast.m 2008-12-24 04:11:17 +0000
+++ SUAppcast.m 2009-06-15 02:30:46 +0000
@@ -60,7 +60,7 @@
60 NSArray *xmlItems = nil;60 NSArray *xmlItems = nil;
61 NSMutableArray *appcastItems = [NSMutableArray array];61 NSMutableArray *appcastItems = [NSMutableArray array];
62 62
63 [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];63 [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
64 [downloadFilename release];64 [downloadFilename release];
65 downloadFilename = nil;65 downloadFilename = nil;
66 66
@@ -177,7 +177,7 @@
177{177{
178 CFRelease(download);178 CFRelease(download);
179 179
180 [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];180 [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
181 [downloadFilename release];181 [downloadFilename release];
182 downloadFilename = nil;182 downloadFilename = nil;
183 183
184184
=== modified file 'SUBasicUpdateDriver.m'
--- SUBasicUpdateDriver.m 2009-05-09 21:31:35 +0000
+++ SUBasicUpdateDriver.m 2009-06-15 02:30:46 +0000
@@ -144,7 +144,7 @@
144 int cnt=1;144 int cnt=1;
145 while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)145 while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
146 tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]];146 tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]];
147 BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil];147 BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
148 if (!success)148 if (!success)
149 {149 {
150 // Okay, something's really broken with /tmp150 // Okay, something's really broken with /tmp
@@ -223,8 +223,8 @@
223 NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];223 NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
224 NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];224 NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
225 // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems225 // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems
226 [[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];226 [[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL];
227 if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])227 if ([[NSFileManager defaultManager] copyItemAtPath:relaunchPathToCopy toPath:targetPath error:NULL])
228 relaunchPath = [targetPath retain];228 relaunchPath = [targetPath retain];
229 229
230 [SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self _versionComparator]];230 [SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self _versionComparator]];
@@ -274,13 +274,13 @@
274274
275- (void)cleanUp275- (void)cleanUp
276{276{
277 [[NSFileManager defaultManager] removeFileAtPath:[downloadPath stringByDeletingLastPathComponent] handler:nil]; 277 [[NSFileManager defaultManager] removeItemAtPath:[downloadPath stringByDeletingLastPathComponent] error:NULL];
278}278}
279279
280- (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error280- (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error
281{281{
282 if (aHost != host) { return; }282 if (aHost != host) { return; }
283 [[NSFileManager defaultManager] removeFileAtPath:relaunchPath handler:NULL]; // Clean up the copied relauncher.283 [[NSFileManager defaultManager] removeItemAtPath:relaunchPath error:NULL]; // Clean up the copied relauncher.
284 [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];284 [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
285}285}
286286
287287
=== modified file 'SUDiskImageUnarchiver.m'
--- SUDiskImageUnarchiver.m 2008-07-17 05:48:10 +0000
+++ SUDiskImageUnarchiver.m 2009-06-15 02:30:46 +0000
@@ -33,7 +33,7 @@
33 if ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;33 if ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
3434
35 // create mount point folder35 // create mount point folder
36 [[NSFileManager defaultManager] createDirectoryAtPath:mountPoint attributes:nil];36 [[NSFileManager defaultManager] createDirectoryAtPath:mountPoint withIntermediateDirectories:YES attributes:nil error:NULL];
37 if (![[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;37 if (![[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
3838
39 NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil];39 NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil];
@@ -47,16 +47,16 @@
47 47
48 // Now that we've mounted it, we need to copy out its contents.48 // Now that we've mounted it, we need to copy out its contents.
49 NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[mountPoint lastPathComponent]];49 NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[mountPoint lastPathComponent]];
50 if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath attributes:nil]) goto reportError;50 if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath withIntermediateDirectories:YES attributes:nil error:NULL]) goto reportError;
51 51
52 // We can't just copyPath: from the volume root because that always fails. Seems to be a bug.52 // We can't just copyPath: from the volume root because that always fails. Seems to be a bug.
53 id subpathEnumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:mountPoint] objectEnumerator], currentSubpath;53 id subpathEnumerator = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:mountPoint error:NULL] objectEnumerator], currentSubpath;
54 while ((currentSubpath = [subpathEnumerator nextObject]))54 while ((currentSubpath = [subpathEnumerator nextObject]))
55 {55 {
56 NSString *currentFullPath = [mountPoint stringByAppendingPathComponent:currentSubpath];56 NSString *currentFullPath = [mountPoint stringByAppendingPathComponent:currentSubpath];
57 // Don't bother trying (and failing) to copy out files we can't read. That's not going to be the app anyway.57 // Don't bother trying (and failing) to copy out files we can't read. That's not going to be the app anyway.
58 if (![[NSFileManager defaultManager] isReadableFileAtPath:currentFullPath]) continue;58 if (![[NSFileManager defaultManager] isReadableFileAtPath:currentFullPath]) continue;
59 if (![[NSFileManager defaultManager] copyPath:currentFullPath toPath:[targetPath stringByAppendingPathComponent:currentSubpath] handler:nil])59 if (![[NSFileManager defaultManager] copyItemAtPath:currentFullPath toPath:[targetPath stringByAppendingPathComponent:currentSubpath] error:NULL])
60 goto reportError;60 goto reportError;
61 }61 }
62 62
@@ -70,7 +70,7 @@
70 if (mountedSuccessfully)70 if (mountedSuccessfully)
71 [NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];71 [NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];
72 else72 else
73 [[NSFileManager defaultManager] removeFileAtPath:mountPoint handler:nil];73 [[NSFileManager defaultManager] removeItemAtPath:mountPoint error:NULL];
74 [pool drain];74 [pool drain];
75}75}
7676
7777
=== modified file 'SUHost.m'
--- SUHost.m 2009-01-12 22:31:52 +0000
+++ SUHost.m 2009-06-15 02:30:46 +0000
@@ -19,7 +19,7 @@
19 {19 {
20 bundle = [aBundle retain];20 bundle = [aBundle retain];
21 if (![bundle bundleIdentifier])21 if (![bundle bundleIdentifier])
22 NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.");22 NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
23 }23 }
24 return self;24 return self;
25}25}
2626
=== modified file 'SUInstaller.m'
--- SUInstaller.m 2009-02-11 22:54:55 +0000
+++ SUInstaller.m 2009-06-15 02:30:46 +0000
@@ -9,7 +9,7 @@
9#import "SUInstaller.h"9#import "SUInstaller.h"
10#import "SUPlainInstaller.h"10#import "SUPlainInstaller.h"
11#import "SUPackageInstaller.h"11#import "SUPackageInstaller.h"
12#import "SUHost.h"12#import "SUHost.h"
1313
14@implementation SUInstaller14@implementation SUInstaller
1515
1616
=== modified file 'SUPipedUnarchiver.m'
--- SUPipedUnarchiver.m 2008-07-24 03:54:10 +0000
+++ SUPipedUnarchiver.m 2009-06-15 02:30:46 +0000
@@ -48,7 +48,7 @@
48 FILE *fp = NULL, *cmdFP = NULL;48 FILE *fp = NULL, *cmdFP = NULL;
49 49
50 // Get the file size.50 // Get the file size.
51 NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];51 NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:NULL] objectForKey:NSFileSize];
52 if (fs == nil) goto reportError;52 if (fs == nil) goto reportError;
53 53
54 // Thank you, Allan Odgaard!54 // Thank you, Allan Odgaard!
5555
=== modified file 'SUPlainInstaller.h'
--- SUPlainInstaller.h 2008-09-10 16:47:58 +0000
+++ SUPlainInstaller.h 2009-06-15 02:30:46 +0000
@@ -11,6 +11,7 @@
1111
12#import "Sparkle.h"12#import "Sparkle.h"
13#import "SUInstaller.h"13#import "SUInstaller.h"
14#import "SUHost.h"
14#import "SUVersionComparisonProtocol.h"15#import "SUVersionComparisonProtocol.h"
1516
16@interface SUPlainInstaller : SUInstaller { }17@interface SUPlainInstaller : SUInstaller { }
1718
=== modified file 'SUPlainInstallerInternals.m'
--- SUPlainInstallerInternals.m 2009-01-10 02:57:29 +0000
+++ SUPlainInstallerInternals.m 2009-06-15 02:30:46 +0000
@@ -235,13 +235,13 @@
235235
236 NSString *tmpPath = [self _temporaryCopyNameForPath:dst];236 NSString *tmpPath = [self _temporaryCopyNameForPath:dst];
237237
238 if (![[NSFileManager defaultManager] movePath:dst toPath:tmpPath handler:self])238 if (![[NSFileManager defaultManager] moveItemAtPath:dst toPath:tmpPath error:NULL])
239 {239 {
240 if (error != NULL)240 if (error != NULL)
241 *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];241 *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
242 return NO; 242 return NO;
243 }243 }
244 if (![[NSFileManager defaultManager] copyPath:src toPath:dst handler:self])244 if (![[NSFileManager defaultManager] copyItemAtPath:src toPath:dst error:NULL])
245 {245 {
246 if (error != NULL)246 if (error != NULL)
247 *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]];247 *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]];
@@ -320,7 +320,7 @@
320 // Only recurse if it's actually a directory. Don't recurse into a320 // Only recurse if it's actually a directory. Don't recurse into a
321 // root-level symbolic link.321 // root-level symbolic link.
322 NSDictionary* rootAttributes =322 NSDictionary* rootAttributes =
323 [[NSFileManager defaultManager] fileAttributesAtPath:root traverseLink:NO];323 [[NSFileManager defaultManager] attributesOfItemAtPath:root error:NULL];
324 NSString* rootType = [rootAttributes objectForKey:NSFileType];324 NSString* rootType = [rootAttributes objectForKey:NSFileType];
325 325
326 if (rootType == NSFileTypeDirectory) {326 if (rootType == NSFileTypeDirectory) {
327327
=== modified file 'SUUIBasedUpdateDriver.m'
--- SUUIBasedUpdateDriver.m 2009-01-08 18:49:41 +0000
+++ SUUIBasedUpdateDriver.m 2009-06-15 02:30:46 +0000
@@ -122,7 +122,7 @@
122{122{
123 // We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.123 // We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
124 if ([statusController maxProgressValue] == 0)124 if ([statusController maxProgressValue] == 0)
125 [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO] objectForKey:NSFileSize] doubleValue]];125 [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:NULL] objectForKey:NSFileSize] doubleValue]];
126 [statusController setProgressValue:[statusController progressValue] + length];126 [statusController setProgressValue:[statusController progressValue] + length];
127}127}
128128
129129
=== modified file 'Sparkle.xcodeproj/project.pbxproj'
--- Sparkle.xcodeproj/project.pbxproj 2009-05-22 04:02:35 +0000
+++ Sparkle.xcodeproj/project.pbxproj 2009-06-15 02:30:46 +0000
@@ -1022,6 +1022,7 @@
1022 1DEB91B208733DA50010E9CD /* Debug */ = {1022 1DEB91B208733DA50010E9CD /* Debug */ = {
1023 isa = XCBuildConfiguration;1023 isa = XCBuildConfiguration;
1024 buildSettings = {1024 buildSettings = {
1025 GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
1025 WARNING_CFLAGS = "-Wundeclared-selector";1026 WARNING_CFLAGS = "-Wundeclared-selector";
1026 };1027 };
1027 name = Debug;1028 name = Debug;
@@ -1029,6 +1030,7 @@
1029 1DEB91B308733DA50010E9CD /* Release */ = {1030 1DEB91B308733DA50010E9CD /* Release */ = {
1030 isa = XCBuildConfiguration;1031 isa = XCBuildConfiguration;
1031 buildSettings = {1032 buildSettings = {
1033 GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
1032 WARNING_CFLAGS = "-Wundeclared-selector";1034 WARNING_CFLAGS = "-Wundeclared-selector";
1033 };1035 };
1034 name = Release;1036 name = Release;
@@ -1036,7 +1038,7 @@
1036 61072EAD0DF263BD008FE88B /* Release (GC dual-mode; 10.5-only) */ = {1038 61072EAD0DF263BD008FE88B /* Release (GC dual-mode; 10.5-only) */ = {
1037 isa = XCBuildConfiguration;1039 isa = XCBuildConfiguration;
1038 buildSettings = {1040 buildSettings = {
1039 GCC_VERSION = "";1041 GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
1040 WARNING_CFLAGS = "-Wundeclared-selector";1042 WARNING_CFLAGS = "-Wundeclared-selector";
1041 };1043 };
1042 name = "Release (GC dual-mode; 10.5-only)";1044 name = "Release (GC dual-mode; 10.5-only)";
10431045
=== modified file 'relaunch.m'
--- relaunch.m 2008-07-01 03:13:43 +0000
+++ relaunch.m 2009-06-15 02:30:46 +0000
@@ -39,7 +39,7 @@
39- (void) relaunch39- (void) relaunch
40{40{
41 [[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]];41 [[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]];
42 [[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil];42 [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] error:NULL];
43 exit(0);43 exit(0);
44}44}
4545

Subscribers

People subscribed via source and target branches