Skip to content

Commit

Permalink
Merge pull request pokeb#211 from christophercotton/master
Browse files Browse the repository at this point in the history
Cache Error with downloadDestinationPath, Not storing downloaded data
  • Loading branch information
pokeb committed Aug 6, 2011
2 parents ca6df3f + 22f1b31 commit e7fff59
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/ASIDownloadCache.m
Expand Up @@ -159,9 +159,14 @@ - (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval

if ([request responseData]) {
[[request responseData] writeToFile:dataPath atomically:NO];
} else if ([request downloadDestinationPath] && ![[request downloadDestinationPath] isEqualToString:dataPath]) {
} else if ([request downloadDestinationPath] && ![[request downloadDestinationPath] isEqualToString:dataPath]) {
NSError *error = nil;
[[[[NSFileManager alloc] init] autorelease] copyItemAtPath:[request downloadDestinationPath] toPath:dataPath error:&error];
NSFileManager* manager = [[NSFileManager alloc] init];
if ([manager fileExistsAtPath:dataPath]) {
[manager removeItemAtPath:dataPath error:&error];
}
[manager copyItemAtPath:[request downloadDestinationPath] toPath:dataPath error:&error];
[manager release];
}
[[self accessLock] unlock];
}
Expand Down

0 comments on commit e7fff59

Please sign in to comment.