61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
-
-
-
+
+
+
|
@implementation GZIPArchive
+ (void)initialize
{
if (self == [GZIPArchive class])
app = (OFArc *)[OFApplication sharedApplication].delegate;
}
+ (instancetype)archiveWithPath: (OFString *)path
+ (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream
mode: (OFString *)mode
encoding: (OFStringEncoding)encoding
stream: (OF_KINDOF(OFStream *))stream
mode: (OFString *)mode
encoding: (OFStringEncoding)encoding
{
return [[[self alloc] initWithStream: stream
mode: mode
encoding: encoding] autorelease];
return [[[self alloc] initWithPath: path
stream: stream
mode: mode
encoding: encoding] autorelease];
}
- (instancetype)initWithPath: (OFString *)path
- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream
mode: (OFString *)mode
encoding: (OFStringEncoding)encoding
stream: (OF_KINDOF(OFStream *))stream
mode: (OFString *)mode
encoding: (OFStringEncoding)encoding
{
self = [super init];
@try {
_stream = [[OFGZIPStream alloc] initWithStream: stream
mode: mode];
} @catch (id e) {
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
-
-
+
+
|
- (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files
{
OFString *fileName;
OFFile *output;
if (files.count != 0) {
[OFStdErr writeLine:
OF_LOCALIZED(@"cannot_extract_specific_file_from_gz",
[OFStdErr writeLine: OF_LOCALIZED(
@"cannot_extract_specific_file_from_gz",
@"Cannot extract a specific file of a .gz archive!")];
app->_exitStatus = 1;
return;
}
fileName = app->_archivePath.lastPathComponent
.stringByDeletingPathExtension;
|