17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <string.h>
#import "OFApplication.h"
#import "OFArray.h"
#import "OFFile.h"
#import "OFFileManager.h"
#import "OFLocale.h"
#import "OFOptionsParser.h"
#import "OFSandbox.h"
#import "OFStdIOStream.h"
#import "OFURI.h"
#import "OFArc.h"
#import "GZIPArchive.h"
#import "LHAArchive.h"
#import "TarArchive.h"
#import "ZIPArchive.h"
|
>
<
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <string.h>
#import "OFApplication.h"
#import "OFArray.h"
#import "OFFile.h"
#import "OFFileManager.h"
#import "OFIRI.h"
#import "OFLocale.h"
#import "OFOptionsParser.h"
#import "OFSandbox.h"
#import "OFStdIOStream.h"
#import "OFArc.h"
#import "GZIPArchive.h"
#import "LHAArchive.h"
#import "TarArchive.h"
#import "ZIPArchive.h"
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
[expandedFiles addObject: file];
}
[archive addFiles: expandedFiles];
}
@implementation OFArc
- (void)applicationDidFinishLaunching
{
OFString *outputDir, *encodingString, *type;
const OFOptionsParserOption options[] = {
{ 'a', @"append", 0, NULL, NULL },
{ 'c', @"create", 0, NULL, NULL },
{ 'C', @"directory", 1, NULL, &outputDir },
{ 'E', @"encoding", 1, NULL, &encodingString },
|
|
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
[expandedFiles addObject: file];
}
[archive addFiles: expandedFiles];
}
@implementation OFArc
- (void)applicationDidFinishLaunching: (OFNotification *)notification
{
OFString *outputDir, *encodingString, *type;
const OFOptionsParserOption options[] = {
{ 'a', @"append", 0, NULL, NULL },
{ 'c', @"create", 0, NULL, NULL },
{ 'C', @"directory", 1, NULL, &outputDir },
{ 'E', @"encoding", 1, NULL, &encodingString },
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
/* Dropped after parsing options */
sandbox.allowsUnveil = true;
[OFApplication of_activateSandbox: sandbox];
#endif
#ifndef OF_AMIGAOS
[OFLocale addLocalizationDirectory: @LOCALIZATION_DIR];
#else
[OFLocale addLocalizationDirectory:
@"PROGDIR:/share/ofarc/localization"];
#endif
optionsParser = [OFOptionsParser parserWithOptions: options];
while ((option = [optionsParser nextOption]) != '\0') {
switch (option) {
case 'f':
if (_overwrite < 0)
|
|
>
|
|
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
/* Dropped after parsing options */
sandbox.allowsUnveil = true;
[OFApplication of_activateSandbox: sandbox];
#endif
#ifndef OF_AMIGAOS
[OFLocale addLocalizationDirectoryIRI:
[OFIRI fileIRIWithPath: @LOCALIZATION_DIR]];
#else
[OFLocale addLocalizationDirectoryIRI:
[OFIRI fileIRIWithPath: @"PROGDIR:/share/ofarc/localization"]];
#endif
optionsParser = [OFOptionsParser parserWithOptions: options];
while ((option = [optionsParser nextOption]) != '\0') {
switch (option) {
case 'f':
if (_overwrite < 0)
|
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
OFString *error = [OFString
stringWithCString: strerror(e.errNo)
encoding: [OFLocale encoding]];
[OFStdErr writeString: @"\r"];
[OFStdErr writeLine: OF_LOCALIZED(
@"failed_to_create_directory",
@"Failed to create directory %[dir]: %[error]",
@"dir", e.URI.fileSystemRepresentation,
@"error", error)];
_exitStatus = 1;
} @catch (OFOpenItemFailedException *e) {
OFString *error = [OFString
stringWithCString: strerror(e.errNo)
encoding: [OFLocale encoding]];
[OFStdErr writeString: @"\r"];
|
|
|
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
OFString *error = [OFString
stringWithCString: strerror(e.errNo)
encoding: [OFLocale encoding]];
[OFStdErr writeString: @"\r"];
[OFStdErr writeLine: OF_LOCALIZED(
@"failed_to_create_directory",
@"Failed to create directory %[dir]: %[error]",
@"dir", e.IRI.fileSystemRepresentation,
@"error", error)];
_exitStatus = 1;
} @catch (OFOpenItemFailedException *e) {
OFString *error = [OFString
stringWithCString: strerror(e.errNo)
encoding: [OFLocale encoding]];
[OFStdErr writeString: @"\r"];
|