Differences From Artifact [bb7c13caac]:
- File
src/OFURL.m
— part of check-in
[81156ee75a]
at
2018-02-25 17:16:23
on branch trunk
— No self = [self init…] with self-releasing @catch
When using self = [self init…], this already releases self on an
exception, so using it inside of a @try / @catch block that releases
self would lead to a double-release. (user: js, size: 23329) [annotate] [blame] [check-ins using]
To Artifact [13457e7f1d]:
- File
src/OFURL.m
— part of check-in
[156b850131]
at
2018-03-11 12:55:20
on branch trunk
— Remove OF_PATH_* macros
These were way too simplistic, as paths differ in more than just that on
various operating systems. (user: js, size: 23298) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
601 602 603 604 605 606 607 | - (instancetype)initFileURLWithPath: (OFString *)path { bool isDirectory; @try { void *pool = objc_autoreleasePoolPush(); | > | > > > > > | < < < < | | < < | 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 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | - (instancetype)initFileURLWithPath: (OFString *)path { bool isDirectory; @try { void *pool = objc_autoreleasePoolPush(); #if defined(OF_WINDOWS) || defined(OF_MSDOS) isDirectory = ([path hasSuffix: @"\\"] || [path hasSuffix: @"/"] || [OFURLHandler_file of_directoryExistsAtPath: path]); #else isDirectory = ([path hasSuffix: @"/"] || [OFURLHandler_file of_directoryExistsAtPath: path]); #endif objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } self = [self initFileURLWithPath: path isDirectory: isDirectory]; return self; } - (instancetype)initFileURLWithPath: (OFString *)path isDirectory: (bool)isDirectory { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); # if defined(OF_WINDOWS) || defined(OF_DJGPP) OFArray OF_GENERIC(OFString *) *pathComponents = [path pathComponents]; path = [pathComponents componentsJoinedByString: @"/"]; if ([[pathComponents firstObject] hasSuffix: @":"]) path = [path stringByPrependingString: @"/"]; # endif if (isDirectory && ![path hasSuffix: @"/"]) path = [path stringByAppendingString: @"/"]; _URLEncodedScheme = @"file"; if (![path hasPrefix: @"/"]) { OFString *currentDirectoryPath = [[OFFileManager defaultManager] currentDirectoryPath]; # if defined(OF_WINDOWS) || defined(OF_DJGPP) currentDirectoryPath = [[currentDirectoryPath pathComponents] componentsJoinedByString: @"/"]; currentDirectoryPath = [currentDirectoryPath stringByPrependingString: @"/"]; # endif path = [currentDirectoryPath stringByAppendingURLPathComponent: path]; path = [path stringByStandardizingURLPath]; |
︙ | ︙ | |||
971 972 973 974 975 976 977 | path = [self path]; if ([path hasSuffix: @"/"]) path = [path substringWithRange: of_range(0, [path length] - 1)]; | | < < < | 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | path = [self path]; if ([path hasSuffix: @"/"]) path = [path substringWithRange: of_range(0, [path length] - 1)]; #if defined(OF_WINDOWS) || defined(OF_MSDOS) path = [path substringWithRange: of_range(1, [path length] - 1)]; path = [OFString pathWithComponents: [path componentsSeparatedByString: @"/"]]; #endif [path retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |