@@ -1152,10 +1152,31 @@ objc_autoreleasePoolPop(pool); return [ret autorelease]; } + +- (OFString *)pathExtension +{ + void *pool = objc_autoreleasePoolPush(); + OFString *ret, *fileName; + size_t pos; + + fileName = self.lastPathComponent; + pos = [fileName rangeOfString: @"." + options: OFStringSearchBackwards].location; + if (pos == OFNotFound || pos == 0) { + objc_autoreleasePoolPop(pool); + return @""; + } + + ret = [fileName substringFromIndex: pos + 1]; + + [ret retain]; + objc_autoreleasePoolPop(pool); + return [ret autorelease]; +} - (OFString *)query { return _percentEncodedQuery.stringByRemovingPercentEncoding; } @@ -1318,10 +1339,26 @@ OFMutableIRI *IRI = [[self mutableCopy] autorelease]; [IRI deleteLastPathComponent]; [IRI makeImmutable]; return IRI; } + +- (OFIRI *)IRIByAppendingPathExtension: (OFString *)extension +{ + OFMutableIRI *IRI = [[self mutableCopy] autorelease]; + [IRI appendPathExtension: extension]; + [IRI makeImmutable]; + return IRI; +} + +- (OFIRI *)IRIByDeletingPathExtension +{ + OFMutableIRI *IRI = [[self mutableCopy] autorelease]; + [IRI deletePathExtension]; + [IRI makeImmutable]; + return IRI; +} - (OFIRI *)IRIByStandardizingPath { OFMutableIRI *IRI = [[self mutableCopy] autorelease]; [IRI standardizePath];