157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
objc_autoreleasePoolPop(pool);
return @"";
}
ret = [fileName substringWithRange:
of_range(pos + 1, fileName.length - pos - 1)];
[ret retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
- (OFString *)stringByDeletingLastPathComponent
|
|
<
|
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
objc_autoreleasePoolPop(pool);
return @"";
}
ret = [fileName substringWithFromIndex: pos + 1];
[ret retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
- (OFString *)stringByDeletingLastPathComponent
|
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
objc_autoreleasePoolPop(pool);
return [[self copy] autorelease];
}
fileName = [fileName substringWithRange: of_range(0, pos)];
[components replaceObjectAtIndex: components.count - 1
withObject: fileName];
ret = [OFString pathWithComponents: components];
[ret retain];
objc_autoreleasePoolPop(pool);
|
|
|
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
objc_autoreleasePoolPop(pool);
return [[self copy] autorelease];
}
fileName = [fileName substringToIndex: pos];
[components replaceObjectAtIndex: components.count - 1
withObject: fileName];
ret = [OFString pathWithComponents: components];
[ret retain];
objc_autoreleasePoolPop(pool);
|
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
}
- (OFString *)of_URLPathToPathWithURLEncodedHost: (OFString *)URLEncodedHost
{
OFString *path = self;
if (path.length > 1 && [path hasSuffix: @"/"])
path = [path substringWithRange: of_range(0, path.length - 1)];
return [path substringWithRange: of_range(1, path.length - 1)];
}
- (OFString *)of_pathComponentToURLPathComponent
{
return self;
}
@end
|
|
|
|
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
}
- (OFString *)of_URLPathToPathWithURLEncodedHost: (OFString *)URLEncodedHost
{
OFString *path = self;
if (path.length > 1 && [path hasSuffix: @"/"])
path = [path substringToIndex: path.length - 1];
return [path substringFromIndex: 1];
}
- (OFString *)of_pathComponentToURLPathComponent
{
return self;
}
@end
|