Differences From Artifact [6804846ccf]:
- File src/OFFileManager.m — part of check-in [1b82d3bf4f] at 2021-03-07 20:25:21 on branch trunk — *.m: Fold methods into one line where it fits (user: js, size: 24377) [annotate] [blame] [check-ins using] [more...]
To Artifact [89ccc3daf1]:
- File
src/OFFileManager.m
— part of check-in
[9135c5fcb8]
at
2021-04-04 18:46:33
on branch trunk
— Change -[contentsOfURLAtPath:] to return URLs
Returning strings is confusing for many as Foundation returns URLs here,
and URLs are often easier to work with during directory enumeration
anyway (no need to constantly append the current item to the base path). (user: js, size: 24481) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
452 453 454 455 456 457 458 | [self createDirectoryAtURL: [OFURL fileURLWithPath: path] createParents: createParents]; objc_autoreleasePoolPop(pool); } #endif | | | > | > > > > | 452 453 454 455 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 | [self createDirectoryAtURL: [OFURL fileURLWithPath: path] createParents: createParents]; objc_autoreleasePoolPop(pool); } #endif - (OFArray OF_GENERIC(OFURL *) *)contentsOfDirectoryAtURL: (OFURL *)URL { OFURLHandler *URLHandler; if (URL == nil) @throw [OFInvalidArgumentException exception]; if ((URLHandler = [OFURLHandler handlerForURL: URL]) == nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; return [URLHandler contentsOfDirectoryAtURL: URL]; } #ifdef OF_HAVE_FILES - (OFArray OF_GENERIC(OFString *) *)contentsOfDirectoryAtPath: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFArray OF_GENERIC(OFURL *) *URLs; OFMutableArray OF_GENERIC(OFString *) *ret; URLs = [self contentsOfDirectoryAtURL: [OFURL fileURLWithPath: path]]; ret = [OFMutableArray arrayWithCapacity: URLs.count]; for (OFURL *URL in URLs) [ret addObject: URL.lastPathComponent]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; } |
︙ | ︙ | |||
593 594 595 596 597 598 599 | destinationURL: destination errNo: e.errNo]; } type = attributes.fileType; if ([type isEqual: of_file_type_directory]) { | | | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | destinationURL: destination errNo: e.errNo]; } type = attributes.fileType; if ([type isEqual: of_file_type_directory]) { OFArray OF_GENERIC(OFURL *) *contents; @try { [self createDirectoryAtURL: destination]; @try { of_file_attribute_key_t key = of_file_attribute_key_posix_permissions; |
︙ | ︙ | |||
633 634 635 636 637 638 639 | exceptionWithSourceURL: source destinationURL: destination errNo: [e errNo]]; @throw e; } | | | < < | < | | | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | exceptionWithSourceURL: source destinationURL: destination errNo: [e errNo]]; @throw e; } for (OFURL *item in contents) { void *pool2 = objc_autoreleasePoolPush(); OFURL *destinationURL = [destination URLByAppendingPathComponent: item.lastPathComponent]; [self copyItemAtURL: item toURL: destinationURL]; objc_autoreleasePoolPop(pool2); } } else if ([type isEqual: of_file_type_regular]) { size_t pageSize = [OFSystemInfo pageSize]; OFStream *sourceStream = nil; OFStream *destinationStream = nil; |
︙ | ︙ |