ObjFW  Diff

Differences From Artifact [d850d81c8b]:

To Artifact [6dbe16477c]:


991
992
993
994
995
996
997




































































998
999
1000
1001
1002
1003
1004

	[path retain];

	objc_autoreleasePoolPop(pool);

	return [path autorelease];
}





































































- (OFString *)description
{
	return [OFString stringWithFormat: @"<%@: %@>",
					   [self class], [self string]];
}








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







991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072

	[path retain];

	objc_autoreleasePoolPop(pool);

	return [path autorelease];
}

- (OFMutableURL *)of_URLByAppendingPathComponent: (OFString *)component
{
	OFMutableURL *ret = [[self mutableCopy] autorelease];
	void *pool;
	OFMutableString *URLEncodedPath;

	if ([component hasPrefix: @"/"]) {
		[ret setPath: component];
		return ret;
	}

	pool = objc_autoreleasePoolPush();
	URLEncodedPath = [[[self URLEncodedPath] mutableCopy] autorelease];

	if (![URLEncodedPath hasSuffix: @"/"])
		[URLEncodedPath appendString: @"/"];

	[URLEncodedPath appendString:
	    [component stringByURLEncodingWithAllowedCharacters:
	    [OFCharacterSet URLPathAllowedCharacterSet]]];

	[ret setURLEncodedPath: URLEncodedPath];

	objc_autoreleasePoolPop(pool);

	return ret;
}

- (OFURL *)URLByAppendingPathComponent: (OFString *)component
{
	OFMutableURL *ret = [self of_URLByAppendingPathComponent: component];

#ifdef OF_HAVE_FILES
	if ([[ret scheme] isEqual: @"file"]) {
		void *pool = objc_autoreleasePoolPush();

		if ([[OFFileManager defaultManager] directoryExistsAtURL: ret])
			[ret setURLEncodedPath: [[ret URLEncodedPath]
			    stringByAppendingString: @"/"]];

		objc_autoreleasePoolPop(pool);
	}
#endif

	[ret makeImmutable];

	return ret;
}

- (OFURL *)URLByAppendingPathComponent: (OFString *)component
			   isDirectory: (bool)isDirectory
{
	OFMutableURL *ret = [self of_URLByAppendingPathComponent: component];

	if (isDirectory) {
		void *pool = objc_autoreleasePoolPush();

		[ret setURLEncodedPath:
		    [[ret URLEncodedPath] stringByAppendingString: @"/"]];

		objc_autoreleasePoolPop(pool);
	}

	[ret makeImmutable];

	return ret;
}

- (OFString *)description
{
	return [OFString stringWithFormat: @"<%@: %@>",
					   [self class], [self string]];
}