ObjFW  Diff

Differences From Artifact [d05bf752db]:

To Artifact [f5b56fbc72]:


234
235
236
237
238
239
240
241

242
243
244











245
246
247
248
249
250
251
252
253
254
255
256
234
235
236
237
238
239
240

241
242
243

244
245
246
247
248
249
250
251
252
253
254
255
256
257


258
259
260
261
262
263
264







-
+


-
+
+
+
+
+
+
+
+
+
+
+



-
-







	objc_autoreleasePoolPop(pool);
	return [ret autorelease];
}

- (OFString *)stringByStandardizingPath
{
	void *pool = objc_autoreleasePoolPush();
	OFArray OF_GENERIC(OFString *) *components = [self pathComponents];
	OFArray OF_GENERIC(OFString *) *components;
	OFMutableArray OF_GENERIC(OFString *) *array;
	OFString *ret;
	bool done = false, endsWithEmpty;
	bool done = false;

	if ([self length] == 0)
		return @"";

	components = [self pathComponents];

	if ([components count] == 1) {
		objc_autoreleasePoolPop(pool);
		return [[self copy] autorelease];
	}

	array = [[components mutableCopy] autorelease];

	endsWithEmpty = [[array lastObject] isEqual: @""];

	while (!done) {
		size_t length = [array count];

		done = true;

		for (size_t i = 0; i < length; i++) {
			OFString *component = [array objectAtIndex: i];
272
273
274
275
276
277
278
279

280
281
282
283
284
285
286
280
281
282
283
284
285
286

287
288
289
290
291
292
293
294







-
+








				done = false;
				break;
			}
		}
	}

	if (endsWithEmpty)
	if ([self hasSuffix: @"\\"] || [self hasSuffix: @"/"])
		[array addObject: @""];

	ret = [[array componentsJoinedByString: @"\\"] retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];