Stefan Bodewig wrote:
> >>>>> "TH" == Thomas Haas <[EMAIL PROTECTED]> 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