Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

corrected cover button and download flow

  • Loading branch information...
commit 3b9f408caf1b826873f9eddabfa6ead80644e8c8 1 parent 209b6f7
Oliver Drobnik Cocoanetics authored
10 Core/Source/DTDownload.m
View
@@ -259,12 +259,10 @@ - (void)_completeDownload
}
// notify delegate
- dispatch_sync(dispatch_get_main_queue(), ^{
- if ([delegate respondsToSelector:@selector(download:didFinishWithFile:)])
- {
- [delegate download:self didFinishWithFile:targetPath];
- }
- });
+ if ([delegate respondsToSelector:@selector(download:didFinishWithFile:)])
+ {
+ [delegate download:self didFinishWithFile:targetPath];
+ }
}
- (void)_updateDownloadInfo
1  Core/Source/DTZipArchive.h
View
@@ -9,6 +9,7 @@
/** This is how the enumeration block needs to look like. Setting *stop to YES will stop the enumeration.
*/
typedef void (^DTZipArchiveEnumerationResultsBlock)(NSString *fileName, NSData *data, BOOL *stop);
+typedef void (^DTZipArchiveUncompressionCompletionBlock)();
/** Supported compression schemes
*/
31 Core/Source/DTZipArchive.m
View
@@ -249,16 +249,35 @@ - (void)_enumeratePKZipUsingBlock:(DTZipArchiveEnumerationResultsBlock)enumerati
NSDate *fileDate = [[NSCalendar currentCalendar] dateFromComponents:comps];
*/
- NSMutableData *tmpData = [[NSMutableData alloc] init];
+ // determine if this is a file or directory
+ BOOL isDirectory = NO;
- int readBytes;
- while((readBytes = unzReadCurrentFile(_unzFile, buffer, BUFFER_SIZE)) > 0)
+ if ([fileName hasSuffix:@"/"] || [fileName hasSuffix:@"\\"])
{
- [tmpData appendBytes:buffer length:readBytes];
+ isDirectory = YES;
}
- // call the enum block
- enumerationBlock(fileName, tmpData, &shouldStop);
+ // change to only use forward slashes
+ fileName = [fileName stringByReplacingOccurrencesOfString:@"\\" withString:@"/"];
+
+ if (isDirectory)
+ {
+ // call the enum block
+ enumerationBlock(fileName, nil, &shouldStop);
+ }
+ else
+ {
+ NSMutableData *tmpData = [[NSMutableData alloc] init];
+
+ int readBytes;
+ while((readBytes = unzReadCurrentFile(_unzFile, buffer, BUFFER_SIZE)) > 0)
+ {
+ [tmpData appendBytes:buffer length:readBytes];
+ }
+
+ // call the enum block
+ enumerationBlock(fileName, tmpData, &shouldStop);
+ }
// close the current file
unzCloseCurrentFile(_unzFile);
Please sign in to comment.
Something went wrong with that request. Please try again.