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
1=== modified file 'SUAppcast.m'
2--- SUAppcast.m 2008-12-24 04:11:17 +0000
3+++ SUAppcast.m 2009-06-15 02:30:46 +0000
4@@ -60,7 +60,7 @@
5 NSArray *xmlItems = nil;
6 NSMutableArray *appcastItems = [NSMutableArray array];
7
8- [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
9+ [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
10 [downloadFilename release];
11 downloadFilename = nil;
12
13@@ -177,7 +177,7 @@
14 {
15 CFRelease(download);
16
17- [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
18+ [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
19 [downloadFilename release];
20 downloadFilename = nil;
21
22
23=== modified file 'SUBasicUpdateDriver.m'
24--- SUBasicUpdateDriver.m 2009-05-09 21:31:35 +0000
25+++ SUBasicUpdateDriver.m 2009-06-15 02:30:46 +0000
26@@ -144,7 +144,7 @@
27 int cnt=1;
28 while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
29 tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]];
30- BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil];
31+ BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
32 if (!success)
33 {
34 // Okay, something's really broken with /tmp
35@@ -223,8 +223,8 @@
36 NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
37 NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
38 // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems
39- [[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];
40- if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
41+ [[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL];
42+ if ([[NSFileManager defaultManager] copyItemAtPath:relaunchPathToCopy toPath:targetPath error:NULL])
43 relaunchPath = [targetPath retain];
44
45 [SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self _versionComparator]];
46@@ -274,13 +274,13 @@
47
48 - (void)cleanUp
49 {
50- [[NSFileManager defaultManager] removeFileAtPath:[downloadPath stringByDeletingLastPathComponent] handler:nil];
51+ [[NSFileManager defaultManager] removeItemAtPath:[downloadPath stringByDeletingLastPathComponent] error:NULL];
52 }
53
54 - (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error
55 {
56 if (aHost != host) { return; }
57- [[NSFileManager defaultManager] removeFileAtPath:relaunchPath handler:NULL]; // Clean up the copied relauncher.
58+ [[NSFileManager defaultManager] removeItemAtPath:relaunchPath error:NULL]; // Clean up the copied relauncher.
59 [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]]];
60 }
61
62
63=== modified file 'SUDiskImageUnarchiver.m'
64--- SUDiskImageUnarchiver.m 2008-07-17 05:48:10 +0000
65+++ SUDiskImageUnarchiver.m 2009-06-15 02:30:46 +0000
66@@ -33,7 +33,7 @@
67 if ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
68
69 // create mount point folder
70- [[NSFileManager defaultManager] createDirectoryAtPath:mountPoint attributes:nil];
71+ [[NSFileManager defaultManager] createDirectoryAtPath:mountPoint withIntermediateDirectories:YES attributes:nil error:NULL];
72 if (![[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
73
74 NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil];
75@@ -47,16 +47,16 @@
76
77 // Now that we've mounted it, we need to copy out its contents.
78 NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[mountPoint lastPathComponent]];
79- if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath attributes:nil]) goto reportError;
80+ if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath withIntermediateDirectories:YES attributes:nil error:NULL]) goto reportError;
81
82 // We can't just copyPath: from the volume root because that always fails. Seems to be a bug.
83- id subpathEnumerator = [[[NSFileManager defaultManager] directoryContentsAtPath:mountPoint] objectEnumerator], currentSubpath;
84+ id subpathEnumerator = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:mountPoint error:NULL] objectEnumerator], currentSubpath;
85 while ((currentSubpath = [subpathEnumerator nextObject]))
86 {
87 NSString *currentFullPath = [mountPoint stringByAppendingPathComponent:currentSubpath];
88 // Don't bother trying (and failing) to copy out files we can't read. That's not going to be the app anyway.
89 if (![[NSFileManager defaultManager] isReadableFileAtPath:currentFullPath]) continue;
90- if (![[NSFileManager defaultManager] copyPath:currentFullPath toPath:[targetPath stringByAppendingPathComponent:currentSubpath] handler:nil])
91+ if (![[NSFileManager defaultManager] copyItemAtPath:currentFullPath toPath:[targetPath stringByAppendingPathComponent:currentSubpath] error:NULL])
92 goto reportError;
93 }
94
95@@ -70,7 +70,7 @@
96 if (mountedSuccessfully)
97 [NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];
98 else
99- [[NSFileManager defaultManager] removeFileAtPath:mountPoint handler:nil];
100+ [[NSFileManager defaultManager] removeItemAtPath:mountPoint error:NULL];
101 [pool drain];
102 }
103
104
105=== modified file 'SUHost.m'
106--- SUHost.m 2009-01-12 22:31:52 +0000
107+++ SUHost.m 2009-06-15 02:30:46 +0000
108@@ -19,7 +19,7 @@
109 {
110 bundle = [aBundle retain];
111 if (![bundle bundleIdentifier])
112- NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.");
113+ NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
114 }
115 return self;
116 }
117
118=== modified file 'SUInstaller.m'
119--- SUInstaller.m 2009-02-11 22:54:55 +0000
120+++ SUInstaller.m 2009-06-15 02:30:46 +0000
121@@ -9,7 +9,7 @@
122 #import "SUInstaller.h"
123 #import "SUPlainInstaller.h"
124 #import "SUPackageInstaller.h"
125-#import "SUHost.h"
126+#import "SUHost.h"
127
128 @implementation SUInstaller
129
130
131=== modified file 'SUPipedUnarchiver.m'
132--- SUPipedUnarchiver.m 2008-07-24 03:54:10 +0000
133+++ SUPipedUnarchiver.m 2009-06-15 02:30:46 +0000
134@@ -48,7 +48,7 @@
135 FILE *fp = NULL, *cmdFP = NULL;
136
137 // Get the file size.
138- NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];
139+ NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:NULL] objectForKey:NSFileSize];
140 if (fs == nil) goto reportError;
141
142 // Thank you, Allan Odgaard!
143
144=== modified file 'SUPlainInstaller.h'
145--- SUPlainInstaller.h 2008-09-10 16:47:58 +0000
146+++ SUPlainInstaller.h 2009-06-15 02:30:46 +0000
147@@ -11,6 +11,7 @@
148
149 #import "Sparkle.h"
150 #import "SUInstaller.h"
151+#import "SUHost.h"
152 #import "SUVersionComparisonProtocol.h"
153
154 @interface SUPlainInstaller : SUInstaller { }
155
156=== modified file 'SUPlainInstallerInternals.m'
157--- SUPlainInstallerInternals.m 2009-01-10 02:57:29 +0000
158+++ SUPlainInstallerInternals.m 2009-06-15 02:30:46 +0000
159@@ -235,13 +235,13 @@
160
161 NSString *tmpPath = [self _temporaryCopyNameForPath:dst];
162
163- if (![[NSFileManager defaultManager] movePath:dst toPath:tmpPath handler:self])
164+ if (![[NSFileManager defaultManager] moveItemAtPath:dst toPath:tmpPath error:NULL])
165 {
166 if (error != NULL)
167 *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
168 return NO;
169 }
170- if (![[NSFileManager defaultManager] copyPath:src toPath:dst handler:self])
171+ if (![[NSFileManager defaultManager] copyItemAtPath:src toPath:dst error:NULL])
172 {
173 if (error != NULL)
174 *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]];
175@@ -320,7 +320,7 @@
176 // Only recurse if it's actually a directory. Don't recurse into a
177 // root-level symbolic link.
178 NSDictionary* rootAttributes =
179- [[NSFileManager defaultManager] fileAttributesAtPath:root traverseLink:NO];
180+ [[NSFileManager defaultManager] attributesOfItemAtPath:root error:NULL];
181 NSString* rootType = [rootAttributes objectForKey:NSFileType];
182
183 if (rootType == NSFileTypeDirectory) {
184
185=== modified file 'SUUIBasedUpdateDriver.m'
186--- SUUIBasedUpdateDriver.m 2009-01-08 18:49:41 +0000
187+++ SUUIBasedUpdateDriver.m 2009-06-15 02:30:46 +0000
188@@ -122,7 +122,7 @@
189 {
190 // We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
191 if ([statusController maxProgressValue] == 0)
192- [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO] objectForKey:NSFileSize] doubleValue]];
193+ [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:NULL] objectForKey:NSFileSize] doubleValue]];
194 [statusController setProgressValue:[statusController progressValue] + length];
195 }
196
197
198=== modified file 'Sparkle.xcodeproj/project.pbxproj'
199--- Sparkle.xcodeproj/project.pbxproj 2009-05-22 04:02:35 +0000
200+++ Sparkle.xcodeproj/project.pbxproj 2009-06-15 02:30:46 +0000
201@@ -1022,6 +1022,7 @@
202 1DEB91B208733DA50010E9CD /* Debug */ = {
203 isa = XCBuildConfiguration;
204 buildSettings = {
205+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
206 WARNING_CFLAGS = "-Wundeclared-selector";
207 };
208 name = Debug;
209@@ -1029,6 +1030,7 @@
210 1DEB91B308733DA50010E9CD /* Release */ = {
211 isa = XCBuildConfiguration;
212 buildSettings = {
213+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
214 WARNING_CFLAGS = "-Wundeclared-selector";
215 };
216 name = Release;
217@@ -1036,7 +1038,7 @@
218 61072EAD0DF263BD008FE88B /* Release (GC dual-mode; 10.5-only) */ = {
219 isa = XCBuildConfiguration;
220 buildSettings = {
221- GCC_VERSION = "";
222+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
223 WARNING_CFLAGS = "-Wundeclared-selector";
224 };
225 name = "Release (GC dual-mode; 10.5-only)";
226
227=== modified file 'relaunch.m'
228--- relaunch.m 2008-07-01 03:13:43 +0000
229+++ relaunch.m 2009-06-15 02:30:46 +0000
230@@ -39,7 +39,7 @@
231 - (void) relaunch
232 {
233 [[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]];
234- [[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil];
235+ [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] error:NULL];
236 exit(0);
237 }
238

Subscribers

People subscribed via source and target branches