Differences From Artifact [6d356b2e44]:
- File
utils/ofarc/ZIPArchive.m
— part of check-in
[f2109cf1c3]
at
2023-07-22 14:47:51
on branch trunk
— utils/ofarc: Pass the path of the archive
This is in preparation for supporting split archives. (user: js, size: 13467) [annotate] [blame] [check-ins using]
To Artifact [1213ad1e65]:
- File
utils/ofarc/ZIPArchive.m
— part of check-in
[630ea6bc5a]
at
2023-07-23 23:35:08
on branch trunk
— OFZIPArchive: Initial support for split archives
This cannot yet extract a file from the archive if the file spans
multiple parts. However, for a multipart archive with multiple files,
all files that only span a single part can be extracted. (user: js, size: 14162) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | stream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode encoding: (OFStringEncoding)encoding { self = [super init]; @try { _archive = [[OFZIPArchive alloc] initWithStream: stream mode: mode]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_archive release]; [super dealloc]; } - (void)listFiles { for (OFZIPArchiveEntry *entry in _archive.entries) { void *pool = objc_autoreleasePoolPush(); [OFStdOut writeLine: entry.fileName]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | stream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode encoding: (OFStringEncoding)encoding { self = [super init]; @try { _path = [path copy]; _archive = [[OFZIPArchive alloc] initWithStream: stream mode: mode]; _archive.delegate = self; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_path release]; [_archive release]; [super dealloc]; } - (OFSeekableStream *)archive: (OFZIPArchive *)archive wantsPartNumbered: (unsigned int)partNumber totalNumberOfParts: (unsigned int)totalNumber { OFString *path; if ([_path.pathExtension caseInsensitiveCompare: @"zip"] != OFOrderedSame) return nil; if (partNumber > 98) return nil; if (partNumber == totalNumber) path = _path; else path = [_path.stringByDeletingPathExtension stringByAppendingFormat: @".z%02u", partNumber + 1]; @try { return [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { if (e.errNo != ENOENT) @throw e; return nil; } } - (void)listFiles { for (OFZIPArchiveEntry *entry in _archive.entries) { void *pool = objc_autoreleasePoolPush(); [OFStdOut writeLine: entry.fileName]; |
︙ | ︙ |