ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: [PATCH] Basename.java has wrong behaviour against suffix removal
Date Thu, 27 Jun 2002 16:49:28 GMT
--- Loc_Pron <loic.peron@bigfoot.com> wrote:
> I just saw Basename.java has wrong behaviour against suffix removal
> which I corrected:
> 
> -            int pos = value.indexOf('.');
> +            int pos = value.lastIndexOf(suffix);
>
> At first, as it is removing a _suffix_, it must use lastIndexOf()
> instead of indexOf(): there would have been problems with file.tar.gz
> for example.

Quite right -- just didn't know about lastIndexOf() back then. I'll fix
it.

> Then, as the complete suffix is supplied, this suffix should be
> removed instead of relying on a '.' suffix separator.

Well, the idea was (and the doc states) that you don't need to specify the
".", since from my perspective, that's what defines a suffix. But I
suppose if people wanted to specify a "suffix" that was, say, _suffix
instead of .suffix, then yeah, it'd need to get the last index of "suffix"
instead of ".". It'd mean people would have to include the "." in the
'suffix' attribute, though, and that would break it for anyone already
relying on it being added for them. I suppose I could add a new attribute
(eg., 'delimiter') that defaults to ".".

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message