ObjFW  Diff

Differences From Artifact [5568ad8169]:

To Artifact [6dd903e8a2]:


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{
	void *pool = objc_autoreleasePoolPush();
	OFStream *file;
	OFINICategory *category = nil;
	OFString *line;

	@try {
		file = [[OFURLHandler handlerForURL: URL] openItemAtURL: URL
								   mode: @"r"];
	} @catch (OFOpenItemFailedException *e) {
		/* Handle missing file like an empty file */
		if (e.errNo == ENOENT)
			return;

		@throw e;
	}







<
|







114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
{
	void *pool = objc_autoreleasePoolPush();
	OFStream *file;
	OFINICategory *category = nil;
	OFString *line;

	@try {

		file = [OFURLHandler openItemAtURL: URL mode: @"r"];
	} @catch (OFOpenItemFailedException *e) {
		/* Handle missing file like an empty file */
		if (e.errNo == ENOENT)
			return;

		@throw e;
	}
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
{
	[self writeToURL: URL encoding: OFStringEncodingUTF8];
}

- (void)writeToURL: (OFURL *)URL encoding: (OFStringEncoding)encoding
{
	void *pool = objc_autoreleasePoolPush();
	OFStream *file = [[OFURLHandler handlerForURL: URL]
	    openItemAtURL: URL
		     mode: @"w"];
	bool first = true;

	for (OFINICategory *category in _categories)
		if ([category of_writeToStream: file
				      encoding: encoding
					 first: first])
			first = false;







<
|
<







157
158
159
160
161
162
163

164

165
166
167
168
169
170
171
{
	[self writeToURL: URL encoding: OFStringEncodingUTF8];
}

- (void)writeToURL: (OFURL *)URL encoding: (OFStringEncoding)encoding
{
	void *pool = objc_autoreleasePoolPush();

	OFStream *file = [OFURLHandler openItemAtURL: URL mode: @"w"];

	bool first = true;

	for (OFINICategory *category in _categories)
		if ([category of_writeToStream: file
				      encoding: encoding
					 first: first])
			first = false;