Make sure we also delete the temp dir when the user clicks "cancel" during the download.

This commit is contained in:
Uli Kusterer committed 2009-12-14 22:30:56 +01:00
1 parent 1b02ab5f7f
commit fa8aaced55
1 file changed
+6 -1
+6 -1
View File
@@ -118,11 +118,16 @@
[statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self _humanReadableSizeFromDouble:[statusController progressValue]]]];
}
- (IBAction)cancelDownload:sender
- (IBAction)cancelDownload: (id)sender
{
if (download)
[download cancel];
[self abortUpdate];
if (tempDir != nil) // tempDir contains downloadPath, so we implicitly delete both here.
{
if( ![[NSFileManager defaultManager] removeFileAtPath: tempDir handler: nil] )
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[tempDir stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[tempDir lastPathComponent]] tag:NULL];
}
}
- (void)extractUpdate