ObjFW  Diff

Differences From Artifact [7016e3a6f1]:

To Artifact [47b11362db]:


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	return [[[self alloc] initWithString: string
			       relativeToURL: URL] autorelease];
}

#ifdef OF_HAVE_FILES
+ (instancetype)fileURLWithPath: (OFString *)path
{
	void *pool = objc_autoreleasePoolPush();
	OFFileManager *fileManager = [OFFileManager defaultManager];
	OFURL *currentDirectoryURL, *URL;

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

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

	currentDirectoryURL =
	    [[OFFileManager defaultManager] currentDirectoryURL];
	URL = [[OFURL alloc] initWithString: path
			      relativeToURL: currentDirectoryURL];

	objc_autoreleasePoolPop(pool);

	return [URL autorelease];
}
#endif

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}







|
<
<
|
<
<
<

<
<
<
|
|
<
<
<
|
<
|
|







50
51
52
53
54
55
56
57


58



59



60
61



62

63
64
65
66
67
68
69
70
71
	return [[[self alloc] initWithString: string
			       relativeToURL: URL] autorelease];
}

#ifdef OF_HAVE_FILES
+ (instancetype)fileURLWithPath: (OFString *)path
{
	return [[[self alloc] initFileURLWithPath: path] autorelease];


}







+ (instancetype)fileURLWithPath: (OFString *)path
		    isDirectory: (bool)isDirectory



{

	return [[[self alloc] initFileURLWithPath: path
				      isDirectory: isDirectory] autorelease];
}
#endif

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}
278
279
280
281
282
283
284




















































285
286
287
288
289
290
291
		@throw e;
	} @finally {
		free(UTF8String2);
	}

	return self;
}





















































- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	@try {
		void *pool = objc_autoreleasePoolPush();

		if (![[element name] isEqual: [self className]] ||







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







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
		@throw e;
	} @finally {
		free(UTF8String2);
	}

	return self;
}

#ifdef OF_HAVE_FILES
- (instancetype)initFileURLWithPath: (OFString *)path
{
	@try {
		void *pool = objc_autoreleasePoolPush();
		OFFileManager *fileManager = [OFFileManager defaultManager];
		bool isDirectory;

		isDirectory = ([path hasSuffix: OF_PATH_DELIMITER_STRING] ||
		    [fileManager directoryExistsAtPath: path]);
		self = [self initFileURLWithPath: path
				     isDirectory: isDirectory];

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

	return self;
}

- (instancetype)initFileURLWithPath: (OFString *)path
			isDirectory: (bool)isDirectory
{
	@try {
		void *pool = objc_autoreleasePoolPush();
		OFURL *currentDirectoryURL;

# if OF_PATH_DELIMITER != '/'
		path = [[path pathComponents] componentsJoinedByString: @"/"];
# 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;
	}

	return self;
}
#endif

- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	@try {
		void *pool = objc_autoreleasePoolPush();

		if (![[element name] isEqual: [self className]] ||