ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Haas <thomas.h...@softwired-inc.com>
Subject Re: Path.java update
Date Thu, 08 Jun 2000 12:17:37 GMT

Stefan Bodewig wrote:

> >>>>> "TH" == Thomas Haas <thomas.haas@softwired-inc.com> writes:
>
>  >>  You could simply call translatePath for single >> filenames as
>  >>  well, couldn't you?
>
>  TH> translatePath returns a list of Strings, whereas translateFile
>  TH> returns a single String and does not mess with path separators.
>
> So just use the first one? Maybe
>
>     public static String translateFile(String source) {
>         if (source == null || source.length() == 0) return "";
>         return (String) translatePath(source).elementAt(0);
>     }
>
> instead of duplicating the / \ replacement. "Once And Only Once" to
> cite an XP mantra - that I wouldn't follow religously of course.

I dislike the dubilcate effort done here aswell. I decided to do it that
way mainly because of two reasons:

   * I did not want to ignore the case where more than one element is
     retuned, maybe just fail.
   * Strange platforms using : or ; differently can still be satisfied by
     not using translatePath.

However I may be pleased by doing it the other way round: let
translatePath first split the path into single elements and then call
translateFile for each element. What do you think?

- tom




Mime
View raw message