Permalink
Browse files

Fixed deprecated APIs to use replacements.

  • Loading branch information...
1 parent 150718a commit f2a7b4b349c52ea366d11183ef041d454025ad93 August Joki committed Jun 15, 2009
View
@@ -60,7 +60,7 @@ - (void)downloadDidFinish:(NSURLDownload *)download
NSArray *xmlItems = nil;
NSMutableArray *appcastItems = [NSMutableArray array];
- [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
+ [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
[downloadFilename release];
downloadFilename = nil;
@@ -177,7 +177,7 @@ - (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
{
CFRelease(download);
- [[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
+ [[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:NULL];
[downloadFilename release];
downloadFilename = nil;
View
@@ -144,7 +144,7 @@ - (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSSt
int cnt=1;
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 999)
tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ %d", prefix, cnt++]];
- BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir attributes:nil];
+ BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
if (!success)
{
// Okay, something's really broken with /tmp
@@ -223,8 +223,8 @@ - (void)installUpdate
NSString *relaunchPathToCopy = [[NSBundle bundleForClass:[self class]] pathForResource:@"relaunch" ofType:@""];
NSString *targetPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems
- [[NSFileManager defaultManager] removeFileAtPath:targetPath handler:nil];
- if ([[NSFileManager defaultManager] copyPath:relaunchPathToCopy toPath:targetPath handler:nil])
+ [[NSFileManager defaultManager] removeItemAtPath:targetPath error:NULL];
+ if ([[NSFileManager defaultManager] copyItemAtPath:relaunchPathToCopy toPath:targetPath error:NULL])
relaunchPath = [targetPath retain];
[SUInstaller installFromUpdateFolder:[downloadPath stringByDeletingLastPathComponent] overHost:host delegate:self synchronously:[self shouldInstallSynchronously] versionComparator:[self _versionComparator]];
@@ -274,13 +274,13 @@ - (void)relaunchHostApp
- (void)cleanUp
{
- [[NSFileManager defaultManager] removeFileAtPath:[downloadPath stringByDeletingLastPathComponent] handler:nil];
+ [[NSFileManager defaultManager] removeItemAtPath:[downloadPath stringByDeletingLastPathComponent] error:NULL];
}
- (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error
{
if (aHost != host) { return; }
- [[NSFileManager defaultManager] removeFileAtPath:relaunchPath handler:NULL]; // Clean up the copied relauncher.
+ [[NSFileManager defaultManager] removeItemAtPath:relaunchPath error:NULL]; // Clean up the copied relauncher.
[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]]];
}
View
@@ -33,7 +33,7 @@ - (void)_extractDMG
if ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
// create mount point folder
- [[NSFileManager defaultManager] createDirectoryAtPath:mountPoint attributes:nil];
+ [[NSFileManager defaultManager] createDirectoryAtPath:mountPoint withIntermediateDirectories:YES attributes:nil error:NULL];
if (![[NSFileManager defaultManager] fileExistsAtPath:mountPoint]) goto reportError;
NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, @"-noverify", @"-nobrowse", @"-noautoopen", nil];
@@ -47,16 +47,16 @@ - (void)_extractDMG
// Now that we've mounted it, we need to copy out its contents.
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[mountPoint lastPathComponent]];
- if (![[NSFileManager defaultManager] createDirectoryAtPath:targetPath attributes:nil]) goto reportError;
+ if (![[NSFileManager defaultManager] 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 = [[[NSFileManager defaultManager] directoryContentsAtPath:mountPoint] objectEnumerator], currentSubpath;
+ id subpathEnumerator = [[[NSFileManager defaultManager] 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 (![[NSFileManager defaultManager] isReadableFileAtPath:currentFullPath]) continue;
- if (![[NSFileManager defaultManager] copyPath:currentFullPath toPath:[targetPath stringByAppendingPathComponent:currentSubpath] handler:nil])
+ if (![[NSFileManager defaultManager] copyItemAtPath:currentFullPath toPath:[targetPath stringByAppendingPathComponent:currentSubpath] error:NULL])
goto reportError;
}
@@ -70,7 +70,7 @@ - (void)_extractDMG
if (mountedSuccessfully)
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];
else
- [[NSFileManager defaultManager] removeFileAtPath:mountPoint handler:nil];
+ [[NSFileManager defaultManager] removeItemAtPath:mountPoint error:NULL];
[pool drain];
}
View
@@ -19,7 +19,7 @@ - (id)initWithBundle:(NSBundle *)aBundle
{
bundle = [aBundle retain];
if (![bundle bundleIdentifier])
- NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.");
+ NSLog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
}
return self;
}
View
@@ -9,7 +9,7 @@
#import "SUInstaller.h"
#import "SUPlainInstaller.h"
#import "SUPackageInstaller.h"
-#import "SUHost.h"
+#import "SUHost.h"
@implementation SUInstaller
View
@@ -48,7 +48,7 @@ - (void)_extractArchivePipingDataToCommand:(NSString *)command
FILE *fp = NULL, *cmdFP = NULL;
// Get the file size.
- NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];
+ NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:NULL] objectForKey:NSFileSize];
if (fs == nil) goto reportError;
// Thank you, Allan Odgaard!
View
@@ -11,6 +11,7 @@
#import "Sparkle.h"
#import "SUInstaller.h"
+#import "SUHost.h"
#import "SUVersionComparisonProtocol.h"
@interface SUPlainInstaller : SUInstaller { }
@@ -235,13 +235,13 @@ + (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst erro
NSString *tmpPath = [self _temporaryCopyNameForPath:dst];
- if (![[NSFileManager defaultManager] movePath:dst toPath:tmpPath handler:self])
+ if (![[NSFileManager defaultManager] 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;
}
- if (![[NSFileManager defaultManager] copyPath:src toPath:dst handler:self])
+ if (![[NSFileManager defaultManager] copyItemAtPath:src 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]];
@@ -320,7 +320,7 @@ + (void)releaseFromQuarantine:(NSString*)root
// Only recurse if it's actually a directory. Don't recurse into a
// root-level symbolic link.
NSDictionary* rootAttributes =
- [[NSFileManager defaultManager] fileAttributesAtPath:root traverseLink:NO];
+ [[NSFileManager defaultManager] attributesOfItemAtPath:root error:NULL];
NSString* rootType = [rootAttributes objectForKey:NSFileType];
if (rootType == NSFileTypeDirectory) {
View
@@ -122,7 +122,7 @@ - (void)unarchiver:(SUUnarchiver *)ua extractedLength:(long)length
{
// We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
if ([statusController maxProgressValue] == 0)
- [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO] objectForKey:NSFileSize] doubleValue]];
+ [statusController setMaxProgressValue:[[[[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:NULL] objectForKey:NSFileSize] doubleValue]];
[statusController setProgressValue:[statusController progressValue] + length];
}
@@ -1022,21 +1022,23 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
WARNING_CFLAGS = "-Wundeclared-selector";
};
name = Debug;
};
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
WARNING_CFLAGS = "-Wundeclared-selector";
};
name = Release;
};
61072EAD0DF263BD008FE88B /* Release (GC dual-mode; 10.5-only) */ = {
isa = XCBuildConfiguration;
buildSettings = {
- GCC_VERSION = "";
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
WARNING_CFLAGS = "-Wundeclared-selector";
};
name = "Release (GC dual-mode; 10.5-only)";
View
@@ -39,7 +39,7 @@ - (void)watchdog:(NSTimer *)timer
- (void) relaunch
{
[[NSWorkspace sharedWorkspace] openFile:[[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablePath length:strlen(executablePath)]];
- [[NSFileManager defaultManager] removeFileAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] handler:nil];
+ [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"relaunch"] error:NULL];
exit(0);
}

0 comments on commit f2a7b4b

Please sign in to comment.