ObjFW  Diff

Differences From Artifact [3539c64da7]:

To Artifact [48639d0542]:


738
739
740
741
742
743
744
















745
746
747
748
749
750
751
			OFString *currentDirectoryPath = [OFFileManager
			    defaultManager].currentDirectoryPath;

			path = [currentDirectoryPath
			    stringByAppendingPathComponent: path];
			path = path.stringByStandardizingPath;
		}

















		path = pathToURLPath(path);

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

		_URLEncodedScheme = @"file";







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
			OFString *currentDirectoryPath = [OFFileManager
			    defaultManager].currentDirectoryPath;

			path = [currentDirectoryPath
			    stringByAppendingPathComponent: path];
			path = path.stringByStandardizingPath;
		}

#ifdef OF_WINDOWS
		if ([path hasPrefix: @"\\\\"]) {
			OFArray *components = path.pathComponents;

			if (components.count < 2)
				@throw [OFInvalidFormatException exception];

			_URLEncodedHost = [[[components objectAtIndex: 1]
			    stringByURLEncodingWithAllowedCharacters:
			    [OFCharacterSet URLHostAllowedCharacterSet]] copy];
			path = [OFString pathWithComponents:
			    [components objectsInRange:
			    of_range(2, components.count - 2)]];
		}
#endif

		path = pathToURLPath(path);

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

		_URLEncodedScheme = @"file";
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062











1063
1064
1065
1066
1067
1068
1069
		@throw [OFInvalidArgumentException exception];

	if (![_URLEncodedPath hasPrefix: @"/"])
		@throw [OFInvalidFormatException exception];

	path = self.path;

	if ([path hasSuffix: @"/"])
		path = [path substringWithRange: of_range(0, path.length - 1)];

	path = URLPathToPath(path);












	[path retain];

	objc_autoreleasePoolPop(pool);

	return [path autorelease];
}







|



>
>
>
>
>
>
>
>
>
>
>







1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
		@throw [OFInvalidArgumentException exception];

	if (![_URLEncodedPath hasPrefix: @"/"])
		@throw [OFInvalidFormatException exception];

	path = self.path;

	if (path.length > 1 && [path hasSuffix: @"/"])
		path = [path substringWithRange: of_range(0, path.length - 1)];

	path = URLPathToPath(path);

#ifdef OF_WINDOWS
	if (_URLEncodedHost != nil) {
		if (path.length == 0)
			path = [OFString stringWithFormat: @"\\\\%@",
							   self.host];
		else
			path = [OFString stringWithFormat: @"\\\\%@\\%@",
							   self.host, path];
	}
#endif

	[path retain];

	objc_autoreleasePoolPop(pool);

	return [path autorelease];
}