150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
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
|
|
<
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
pos = [fileName rangeOfString: @"."
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos == OF_NOT_FOUND || pos == 0) {
objc_autoreleasePoolPop(pool);
return @"";
}
ret = [fileName substringFromIndex: pos + 1];
[ret retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
- (OFString *)stringByDeletingLastPathComponent
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
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);
|
|
|
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
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;
}
- (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;
}
- (OFString *)of_pathComponentToURLPathComponent
{
return self;
}
@end
|