ObjFW  Diff

Differences From Artifact [dfdfaa21fd]:

To Artifact [18e5b35188]:


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
665

	return self;
}

- (instancetype)initFileURLWithPath: (OFString *)path
			isDirectory: (bool)isDirectory
{


	@try {
		void *pool = objc_autoreleasePoolPush();
# if OF_PATH_DELIMITER != '/' || defined(OF_WINDOWS) || defined(OF_DJGPP)
		OFArray OF_GENERIC(OFString *) *pathComponents =
		    [path pathComponents];
# endif
		OFURL *currentDirectoryURL;

# if OF_PATH_DELIMITER != '/'
		path = [pathComponents componentsJoinedByString: @"/"];
# endif

# if defined(OF_WINDOWS) || defined(OF_DJGPP)
		if ([[pathComponents firstObject] hasSuffix: @":"])
			path = [path stringByPrependingString: @"/"];
# endif

		if (isDirectory && ![path hasSuffix: OF_PATH_DELIMITER_STRING])
			path = [path stringByAppendingString: @"/"];




		currentDirectoryURL =
		    [[OFFileManager defaultManager] currentDirectoryURL];

		self = [self initWithString: path
			      relativeToURL: currentDirectoryURL];







		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}








>
>






<













>
>
>
|
|

|
|
>
>
>
>
>
>







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
665
666
667
668
669
670
671
672
673
674
675

	return self;
}

- (instancetype)initFileURLWithPath: (OFString *)path
			isDirectory: (bool)isDirectory
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
# if OF_PATH_DELIMITER != '/' || defined(OF_WINDOWS) || defined(OF_DJGPP)
		OFArray OF_GENERIC(OFString *) *pathComponents =
		    [path pathComponents];
# endif


# if OF_PATH_DELIMITER != '/'
		path = [pathComponents componentsJoinedByString: @"/"];
# endif

# if defined(OF_WINDOWS) || defined(OF_DJGPP)
		if ([[pathComponents firstObject] hasSuffix: @":"])
			path = [path stringByPrependingString: @"/"];
# endif

		if (isDirectory && ![path hasSuffix: OF_PATH_DELIMITER_STRING])
			path = [path stringByAppendingString: @"/"];

		_URLEncodedScheme = @"file";

		if (![path hasPrefix: @"/"]) {
			OFString *currentDirectoryPath = [[OFFileManager
			    defaultManager] currentDirectoryPath];

			path = [OFString stringWithFormat:
			    @"%@/%@", currentDirectoryPath, path];
			path = [path stringByStandardizingURLPath];
		}

		_URLEncodedPath = [[path
		    stringByURLEncodingWithAllowedCharacters:
		    [OFCharacterSet URLPathAllowedCharacterSet]] copy];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}