ObjFW  Diff

Differences From Artifact [6274573b21]:

To Artifact [5a68687d28]:


18
19
20
21
22
23
24



25
26
27
28
29
30
31

#include <stdlib.h>
#include <string.h>

#import "OFURL.h"
#import "OFURL+Private.h"
#import "OFArray.h"



#import "OFNumber.h"
#import "OFString.h"
#import "OFXMLElement.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"







>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <stdlib.h>
#include <string.h>

#import "OFURL.h"
#import "OFURL+Private.h"
#import "OFArray.h"
#ifdef OF_HAVE_FILES
# import "OFFileManager.h"
#endif
#import "OFNumber.h"
#import "OFString.h"
#import "OFXMLElement.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfMemoryException.h"
44
45
46
47
48
49
50

51
52
53
54


55



56

57

58
59



60
61
62
63
64

65
66
67
68
69
70
71
+ (instancetype)URLWithString: (OFString *)string
		relativeToURL: (OFURL *)URL
{
	return [[[self alloc] initWithString: string
			       relativeToURL: URL] autorelease];
}


+ (instancetype)fileURLWithPath: (OFString *)path
{
	OFMutableURL *URL = [OFMutableURL URL];
	void *pool = objc_autoreleasePoolPush();






	[URL setScheme: @"file"];

	[URL setPath: [[path pathComponents] componentsJoinedByString: @"/"]];


	[URL makeImmutable];




	objc_autoreleasePoolPop(pool);

	return URL;
}


- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)of_init







>


<

>
>

>
>
>
|
>
|
>

|
>
>
>



|

>







47
48
49
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
84
85
+ (instancetype)URLWithString: (OFString *)string
		relativeToURL: (OFURL *)URL
{
	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
}

- (instancetype)of_init