234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
- (OFString *)stringByStandardizingPath
{
void *pool = objc_autoreleasePoolPush();
OFArray OF_GENERIC(OFString *) *components = [self pathComponents];
OFMutableArray OF_GENERIC(OFString *) *array;
OFString *ret;
bool done = false, endsWithEmpty;
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];
|
|
|
>
>
>
>
>
>
>
>
>
>
<
<
|
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;
OFMutableArray OF_GENERIC(OFString *) *array;
OFString *ret;
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];
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
|
done = false;
break;
}
}
}
if (endsWithEmpty)
[array addObject: @""];
ret = [[array componentsJoinedByString: @"\\"] retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
|
|
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
done = false;
break;
}
}
}
if ([self hasSuffix: @"\\"] || [self hasSuffix: @"/"])
[array addObject: @""];
ret = [[array componentsJoinedByString: @"\\"] retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
|