140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
writingNotSupported(OFString *type)
{
[OFStdErr writeLine: OF_LOCALIZED(
@"writing_not_supported",
@"Writing archives of type %[type] is not (yet) supported!",
@"type", type)];
}
@implementation OFArc
- (void)applicationDidFinishLaunching
{
OFString *outputDir, *encodingString, *type;
const OFOptionsParserOption options[] = {
{ 'a', @"append", 0, NULL, NULL },
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
writingNotSupported(OFString *type)
{
[OFStdErr writeLine: OF_LOCALIZED(
@"writing_not_supported",
@"Writing archives of type %[type] is not (yet) supported!",
@"type", type)];
}
static void
addFiles(id <Archive> archive, OFArray OF_GENERIC(OFString *) *files)
{
OFMutableArray *expandedFiles =
[OFMutableArray arrayWithCapacity: files.count];
OFFileManager *fileManager = [OFFileManager defaultManager];
for (OFString *file in files)
if ([fileManager directoryExistsAtPath: file])
[expandedFiles addObjectsFromArray:
[fileManager subpathsOfDirectoryAtPath: file]];
else
[expandedFiles addObject: file];
[archive addFiles: expandedFiles];
}
@implementation OFArc
- (void)applicationDidFinishLaunching
{
OFString *outputDir, *encodingString, *type;
const OFOptionsParserOption options[] = {
{ 'a', @"append", 0, NULL, NULL },
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
archive = [self
openArchiveWithPath: remainingArguments.firstObject
type: type
mode: mode
encoding: encoding];
[archive addFiles: files];
break;
case 'l':
if (remainingArguments.count != 1)
help(OFStdErr, false, 1);
#ifdef OF_HAVE_SANDBOX
if (![remainingArguments.firstObject isEqual: @"-"])
|
|
|
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
archive = [self
openArchiveWithPath: remainingArguments.firstObject
type: type
mode: mode
encoding: encoding];
addFiles(archive, files);
break;
case 'l':
if (remainingArguments.count != 1)
help(OFStdErr, false, 1);
#ifdef OF_HAVE_SANDBOX
if (![remainingArguments.firstObject isEqual: @"-"])
|