Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 4503 invoked from network); 5 Aug 2005 17:34:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Aug 2005 17:34:52 -0000 Received: (qmail 72879 invoked by uid 500); 5 Aug 2005 17:34:51 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 72673 invoked by uid 500); 5 Aug 2005 17:34:50 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 72660 invoked by uid 500); 5 Aug 2005 17:34:49 -0000 Received: (qmail 72656 invoked by uid 99); 5 Aug 2005 17:34:49 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 05 Aug 2005 10:34:38 -0700 Received: (qmail 4449 invoked by uid 1818); 5 Aug 2005 17:34:36 -0000 Date: 5 Aug 2005 17:34:36 -0000 Message-ID: <20050805173436.4448.qmail@minotaur.apache.org> From: mbenson@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/types/resources FileResource.java X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N mbenson 2005/08/05 10:34:36 Modified: src/main/org/apache/tools/ant/types/resources FileResource.java Log: Change behavior of getName(); refine compareTo(). Revision Changes Path 1.3 +20 -3 ant/src/main/org/apache/tools/ant/types/resources/FileResource.java Index: FileResource.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/resources/FileResource.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FileResource.java 31 May 2005 19:18:55 -0000 1.2 +++ FileResource.java 5 Aug 2005 17:34:36 -0000 1.3 @@ -124,7 +124,9 @@ } /** - * Get the name of this FileResource relative to its baseDir, if any. + * Get the name of this FileResource. If the basedir is set, + * the name will be relative to that. Otherwise the basename + * only will be returned. * @return the name of this resource. */ public String getName() { @@ -132,7 +134,7 @@ return ((Resource) getCheckedRef()).getName(); } File b = getBaseDir(); - return b == null ? getNotNullFile().getAbsolutePath() + return b == null ? getNotNullFile().getName() : FILE_UTILS.removeLeadingPath(b, getNotNullFile()); } @@ -220,7 +222,22 @@ if (isReference()) { return ((Comparable) getCheckedRef()).compareTo(another); } - return this.equals(another) ? 0 : super.compareTo(another); + if (this.equals(another)) { + return 0; + } + if (another.getClass().equals(getClass())) { + FileResource otherfr = (FileResource) another; + File f = getFile(); + if (f == null) { + return -1; + } + File of = otherfr.getFile(); + if (of == null) { + return 1; + } + return f.compareTo(of); + } + return super.compareTo(another); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org