Differences From Artifact [402b43560b]:
- File
utils/ofzip/TarArchive.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 14979) [annotate] [blame] [check-ins using]
To Artifact [f838c45385]:
- File
utils/ofzip/TarArchive.m
— part of check-in
[34fe205b84]
at
2017-11-12 18:27:56
on branch trunk
— OFFileManager: Major API redesign
This removes all query methods and replaces them by a single one that
returns a dictionary. Not only does this allow querying multiple
attributes at once, it is also more extensible, as the previous
attributes were specific to file URLs. (user: js, size: 15079) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
14 15 16 17 18 19 20 21 | * file. */ #include "config.h" #include <inttypes.h> #import "OFDate.h" | > | > | | < > > > > | | < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | * file. */ #include "config.h" #include <inttypes.h> #import "OFApplication.h" #import "OFDate.h" #import "OFFileManager.h" #import "OFLocalization.h" #import "OFNumber.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "TarArchive.h" #import "OFZIP.h" static OFZIP *app; static void setPermissions(OFString *path, OFTarArchiveEntry *entry) { #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS of_file_attributes_t attributes = [OFDictionary dictionaryWithObject: [OFNumber numberWithUInt16: [entry mode]] forKey: of_file_attribute_key_posix_permissions]; [[OFFileManager defaultManager] setAttributes: attributes ofItemAtPath: path]; #endif } @implementation TarArchive + (void)initialize { if (self == [TarArchive class]) |
︙ | ︙ | |||
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | @"Need one or more files to add!")]; app->_exitStatus = 1; return; } for (OFString *fileName in files) { void *pool = objc_autoreleasePoolPush(); OFMutableTarArchiveEntry *entry; OFStream *output; if (app->_outputLevel >= 0) [of_stdout writeString: OF_LOCALIZED(@"adding_file", @"Adding %[file]...", @"file", fileName)]; entry = [OFMutableTarArchiveEntry entryWithFileName: fileName]; #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS | > > > > | < | | < < < < < < < < < < < | | | | | | | | | | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | @"Need one or more files to add!")]; app->_exitStatus = 1; return; } for (OFString *fileName in files) { void *pool = objc_autoreleasePoolPush(); of_file_attributes_t attributes; of_file_type_t type; OFMutableTarArchiveEntry *entry; OFStream *output; if (app->_outputLevel >= 0) [of_stdout writeString: OF_LOCALIZED(@"adding_file", @"Adding %[file]...", @"file", fileName)]; attributes = [fileManager attributesOfItemAtPath: fileName]; type = [attributes fileType]; entry = [OFMutableTarArchiveEntry entryWithFileName: fileName]; #ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS [entry setMode: [attributes filePOSIXPermissions]]; #endif [entry setSize: [attributes fileSize]]; [entry setModificationDate: [attributes fileModificationDate]]; #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER [entry setUID: [attributes filePOSIXUID]]; [entry setGID: [attributes filePOSIXGID]]; [entry setOwner: [attributes fileOwner]]; [entry setGroup: [attributes fileGroup]]; #endif if ([type isEqual: of_file_type_regular]) [entry setType: OF_TAR_ARCHIVE_ENTRY_TYPE_FILE]; else if ([type isEqual: of_file_type_directory]) { [entry setType: OF_TAR_ARCHIVE_ENTRY_TYPE_DIRECTORY]; [entry setSize: 0]; } else if ([type isEqual: of_file_type_symbolic_link]) { [entry setType: OF_TAR_ARCHIVE_ENTRY_TYPE_SYMLINK]; [entry setTargetFileName: [attributes fileSymbolicLinkDestination]]; [entry setSize: 0]; } [entry makeImmutable]; output = [_archive streamForWritingEntry: entry]; |
︙ | ︙ |