Differences From Artifact [f64cd875b8]:
- File
utils/ofzip/OFZIP.m
— part of check-in
[4300366b0b]
at
2016-04-24 02:01:37
on branch trunk
— Refactor OFZIP
This splits out ZIP archive handling from the main file in preparation
for adding GZIP support. (user: js, size: 7517) [annotate] [blame] [check-ins using]
To Artifact [ca3f3e8461]:
- File utils/ofzip/OFZIP.m — part of check-in [34e0dcaf87] at 2016-04-24 02:32:33 on branch trunk — OFZIP: Add GZIP support (user: js, size: 7686) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #import "OFFile.h" #import "OFFileManager.h" #import "OFOptionsParser.h" #import "OFStdIOStream.h" #import "OFZIP.h" #import "ZIPArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #import "OFFile.h" #import "OFFileManager.h" #import "OFOptionsParser.h" #import "OFStdIOStream.h" #import "OFZIP.h" #import "ZIPArchive.h" #import "GZIPArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" |
︙ | ︙ | |||
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | } - (id <Archive>)openArchiveWithPath: (OFString*)path { OFFile *file; id <Archive> archive; @try { file = [OFFile fileWithPath: path mode: @"rb"]; } @catch (OFOpenItemFailedException *e) { [of_stderr writeFormat: @"Failed to open file %@: %s\n", [e path], strerror([e errNo])]; [OFApplication terminateWithStatus: 1]; } @try { | > > > > > > | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | } - (id <Archive>)openArchiveWithPath: (OFString*)path { OFFile *file; id <Archive> archive; [_archivePath release]; _archivePath = [path copy]; @try { file = [OFFile fileWithPath: path mode: @"rb"]; } @catch (OFOpenItemFailedException *e) { [of_stderr writeFormat: @"Failed to open file %@: %s\n", [e path], strerror([e errNo])]; [OFApplication terminateWithStatus: 1]; } @try { if ([path hasSuffix: @".gz"]) archive = [GZIPArchive archiveWithFile: file]; else archive = [ZIPArchive archiveWithFile: file]; } @catch (OFReadFailedException *e) { [of_stderr writeFormat: @"Failed to read file %@: %s\n", path, strerror([e errNo])]; [OFApplication terminateWithStatus: 1]; } @catch (OFInvalidFormatException *e) { [of_stderr writeFormat: @"File %@ is not a valid archive!\n", path]; |
︙ | ︙ |