From 292ff629ec9f640d4a19caf0faa7683e50bc0e18 Mon Sep 17 00:00:00 2001 From: Jim Boyd Date: Tue, 23 Mar 2021 15:58:17 -0600 Subject: [PATCH 1/2] Add support for swift package manager. --- Classes/NVHGzipFile.m | 2 +- Package.swift | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Package.swift diff --git a/Classes/NVHGzipFile.m b/Classes/NVHGzipFile.m index 4830c35..c06bec9 100644 --- a/Classes/NVHGzipFile.m +++ b/Classes/NVHGzipFile.m @@ -26,7 +26,7 @@ typedef NS_ENUM(NSInteger, NVHGzipFileErrorType) @interface NVHGzipFile () -@property (nonatomic,assign) CGFloat fileSizeFraction; +@property (nonatomic,assign) double fileSizeFraction; @end diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..07ecde2 --- /dev/null +++ b/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let package = Package( + name: "NVHTarGzip", + defaultLocalization: "en", + platforms: [ + .iOS(.v12), + .tvOS(.v12), + .macOS(.v10_13), + ], + products: [ + .library( + name: "NVHTarGzip", targets: ["NVHTarGzip"]), + ], + dependencies: [ + ], + targets: [ + .target(name: "NVHTarGzip", + path: "Classes", + publicHeadersPath: ""), + ] +) + From 361a04c6605e72e60eb10be62ccd364ac6c64bde Mon Sep 17 00:00:00 2001 From: James Boyd Date: Fri, 5 Aug 2022 11:12:45 -0600 Subject: [PATCH 2/2] This fixes the following issue for tar files genetrated on the mac --- Classes/NVHTarFile.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Classes/NVHTarFile.m b/Classes/NVHTarFile.m index d633826..b0229ee 100644 --- a/Classes/NVHTarFile.m +++ b/Classes/NVHTarFile.m @@ -32,7 +32,7 @@ // Logging mode // Comment this line for production -//#define TAR_VERBOSE_LOG_MODE +// #define TAR_VERBOSE_LOG_MODE // const definition #define TAR_BLOCK_SIZE 512 @@ -243,6 +243,20 @@ - (BOOL)createFilesAndDirectoriesAtPath:(NSString *)path withTarObject:(id)objec break; } + // This fixes the following issue for tar files genetrated on the mac... + // https://github.com/nvh/NVHTarGzip/issues/8 + case ' ': // .DS_Store filea manifest with an empty string as their type. + { +#ifdef TAR_VERBOSE_LOG_MODE + NSLog(@"UNTAR - unsupported block"); +#endif + @autoreleasepool { + unsigned long long objectSize = [NVHTarFile sizeForObject:object atOffset:location]; + blockCount += ceil(objectSize / TAR_BLOCK_SIZE); + } + break; + } + default: // It's not a tar type { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"Invalid block type found"