Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 20909 invoked from network); 8 Jun 2000 12:21:23 -0000 Received: from i-gate.softwired.ch (212.40.20.70) by locus.apache.org with SMTP; 8 Jun 2000 12:21:23 -0000 Received: from artus.ii.softwired.ch (camelot.softwired.ch [212.40.20.71]) by i-gate.softwired.ch (8.9.1/8.9.1) with ESMTP id OAA03606 for ; Thu, 8 Jun 2000 14:21:23 +0200 Received: from softwired-inc.com (dyna07.ii.softwired.ch [192.168.168.137]) by artus.ii.softwired.ch (8.9.3/8.9.3) with ESMTP id OAA06127 for ; Thu, 8 Jun 2000 14:21:21 +0200 Message-ID: <393F8EE0.91F523F2@softwired-inc.com> Date: Thu, 08 Jun 2000 14:17:37 +0200 From: Thomas Haas X-Mailer: Mozilla 4.73 [en] (WinNT; U) X-Accept-Language: en,pdf MIME-Version: 1.0 To: ant-dev@jakarta.apache.org Subject: Re: Path.java update References: <393EA22B.CFD7BCDA@haas-wyss.ch> <393F8289.D01993C@softwired-inc.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Stefan Bodewig wrote: > >>>>> "TH" == Thomas Haas 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