52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
-
+
-
+
-
+
|
#endif
}
@implementation TarArchive
+ (void)initialize
{
if (self == [TarArchive class])
app = (OFZIP*)[[OFApplication sharedApplication] delegate];
app = (OFZIP *)[[OFApplication sharedApplication] delegate];
}
+ (instancetype)archiveWithStream: (OF_KINDOF(OFStream*))stream
+ (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream
{
return [[[self alloc] initWithStream: stream] autorelease];
}
- initWithStream: (OF_KINDOF(OFStream*))stream
- initWithStream: (OF_KINDOF(OFStream *))stream
{
self = [super init];
@try {
_archive = [[OFTarArchive alloc] initWithStream: stream];
} @catch (id e) {
[self release];
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
-
+
-
+
-
+
|
}
}
objc_autoreleasePoolPop(pool);
}
}
- (void)extractFiles: (OFArray OF_GENERIC(OFString*)*)files
- (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files
{
OFFileManager *fileManager = [OFFileManager defaultManager];
bool all = ([files count] == 0);
OFMutableSet OF_GENERIC(OFString*) *missing =
OFMutableSet OF_GENERIC(OFString *) *missing =
[OFMutableSet setWithArray: files];
OFTarArchiveEntry *entry;
while ((entry = [_archive nextEntry]) != nil) {
void *pool = objc_autoreleasePoolPush();
OFString *fileName = [entry fileName];
OFString *outFileName = [fileName stringByStandardizingPath];
OFArray OF_GENERIC(OFString*) *pathComponents;
OFArray OF_GENERIC(OFString *) *pathComponents;
OFString *directory;
OFFile *output;
uint64_t written = 0, size = [entry size];
int8_t percent = -1, newPercent;
if (!all && ![files containsObject: fileName])
continue;
|
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
-
+
|
@"File %[file] is not in the archive!",
@"file", file)];
app->_exitStatus = 1;
}
}
- (void)printFiles: (OFArray OF_GENERIC(OFString*)*)files_
- (void)printFiles: (OFArray OF_GENERIC(OFString *) *)files_
{
OFMutableSet *files;
OFTarArchiveEntry *entry;
if ([files_ count] < 1) {
[of_stderr writeLine: OF_LOCALIZED(@"print_no_file_specified",
@"Need one or more files to print!")];
|