Differences From Artifact [885333cff3]:
- File
utils/ofarc/OFArc.m
— part of check-in
[51343e2dfc]
at
2018-06-17 16:16:34
on branch trunk
— Rename ofzip to ofarc
It supports more than just ZIP now, so the name was no longer
appropriate. (user: js, size: 19111) [annotate] [blame] [check-ins using]
To Artifact [6e1359d60a]:
- File utils/ofarc/OFArc.m — part of check-in [aa0384d1bf] at 2018-07-28 18:45:36 on branch trunk — Rename OFLocalization -> OFLocale (user: js, size: 19051) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include <string.h> #import "OFApplication.h" #import "OFArray.h" #import "OFFile.h" #import "OFFileManager.h" | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #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 "OFURL.h" #import "OFArc.h" #import "GZIPArchive.h" |
︙ | ︙ | |||
187 188 189 190 191 192 193 | [OFApplication activateSandbox: sandbox]; } @finally { [sandbox release]; } #endif #ifndef OF_AMIGAOS | | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | [OFApplication activateSandbox: sandbox]; } @finally { [sandbox release]; } #endif #ifndef OF_AMIGAOS [OFLocale addLanguageDirectory: @LANGUAGE_DIR]; #else [OFLocale addLanguageDirectory: @"PROGDIR:/share/ofarc/lang"]; #endif optionsParser = [OFOptionsParser parserWithOptions: options]; while ((option = [optionsParser nextOption]) != '\0') { switch (option) { case 'f': if (_overwrite < 0) |
︙ | ︙ | |||
355 356 357 358 359 360 361 | of_range(1, [remainingArguments count] - 1)]; @try { [archive extractFiles: files]; } @catch (OFCreateDirectoryFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) | | | | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | of_range(1, [remainingArguments count] - 1)]; @try { [archive extractFiles: files]; } @catch (OFCreateDirectoryFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_create_directory", @"Failed to create directory %[dir]: %[error]", @"dir", [[e URL] fileSystemRepresentation], @"error", error)]; _exitStatus = 1; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_open_file", @"Failed to open file %[file]: %[error]", @"file", [e path], @"error", error)]; _exitStatus = 1; |
︙ | ︙ | |||
423 424 425 426 427 428 429 | @try { file = [OFFile fileWithPath: path mode: fileModeString]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) | | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | @try { file = [OFFile fileWithPath: path mode: fileModeString]; } @catch (OFOpenItemFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stderr writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED( @"failed_to_open_file", @"Failed to open file %[file]: %[error]", @"file", [e path], @"error", error)]; [OFApplication terminateWithStatus: 1]; |
︙ | ︙ | |||
491 492 493 494 495 496 497 | goto error; } @throw e; } @catch (OFReadFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) | | | | 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | goto error; } @throw e; } @catch (OFReadFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_read_file", @"Failed to read file %[file]: %[error]", @"file", path, @"error", error)]; goto error; } @catch (OFSeekFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_seek_in_file", @"Failed to seek in file %[file]: %[error]", @"file", path, @"error", error)]; goto error; } @catch (OFInvalidFormatException *e) { [of_stderr writeLine: OF_LOCALIZED( |
︙ | ︙ | |||
601 602 603 604 605 606 607 | @try { length = [input readIntoBuffer: buffer length: BUFFER_SIZE]; } @catch (OFReadFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) | | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | @try { length = [input readIntoBuffer: buffer length: BUFFER_SIZE]; } @catch (OFReadFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stdout writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_read_file", @"Failed to read file %[file]: %[error]", @"file", fileName, @"error", error)]; return -1; } @try { [output writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFString *error = [OFString stringWithCString: strerror([e errNo]) encoding: [OFLocale encoding]]; [of_stdout writeString: @"\r"]; [of_stderr writeLine: OF_LOCALIZED(@"failed_to_write_file", @"Failed to write file %[file]: %[error]", @"file", fileName, @"error", error)]; return -1; } |
︙ | ︙ |