Apparently there is a bug in -[NSString pathExtension].
If you have a string @"/path/to/folder.dir/aFile" pathExtension returns @".dir/aFile" which is a bit wrong I guess. There should be @"" as return value. The attached patch fixes this.
Hope you can apply it
Roland
--- NSString.m 2003-09-26 11:19:45.000000000 +0200
+++ NSString.m.new 2003-09-26 11:48:34.000000000 +0200
@@ -2868,7 +2868,7 @@
*/
- (NSString*) pathExtension
{
- NSRange range;
+ NSRange range,range2;
NSString *substring;
unsigned int length = [self length];
@@ -2880,8 +2880,14 @@
length--;
}
range = NSMakeRange(0, length);
- range = [self rangeOfString: @"." options: NSBackwardsSearch range: range];
- if (range.length == 0)
+
+ // search for last pathSep
+ range2 = [self rangeOfCharacterFromSet: pathSeps() options: NSBackwardsSearch
range:range];
+ // search for last @"."
+ range = [self rangeOfString: @"." options: NSBackwardsSearch range: range];
+
+ // if @"." not found or before last pathSep
+ if (range.location == NSNotFound || (range2.location != NSNotFound &&
range.location < range2.location) )
{
substring = @"";
}
_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
