ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Hunt <a...@wolfram.com>
Subject Bug in 'basename'?
Date Thu, 26 Sep 2002 17:59:49 GMT
Hi -

I'm trying to chop the extension off of filenames and am running 
into what is probably a bug in the task 'basename'.

Given two files 'build.xml' and '1.1.1.xml', the following
will chop the extension '.xml':

<?xml version="1.0"?>
<project name="test" default="main" basedir=".">
   <target name="main">
      <property name="file1" value="build.xml" />
      <property name="file2" value="1.1.1.xml" />

      <basename property="baseFile1" file="${file1}" suffix=".xml" />
      <echo message="Basename: ${baseFile1}" />
      <basename property="baseFile2" file="${file2}" suffix=".xml" />
      <echo message="Basename: ${baseFile2}" />
   </target>
</project>


Here's the output:

----
C:\ant\AntTasks\test>ant
Buildfile: build.xml

main:
     [echo] Basename: build
     [echo] Basename: 1

BUILD SUCCESSFUL
Total time: 1 second

----

Notice that 'build.xml' -> 'build' (correct)
but '1.1.1.xml' -> '1' (not correct)

What I'm expecting to be returned is '1.1.1'. Is there
a way around this?

Thanks!




ah.

---
Andrew Hunt
Manager, Electronic Documentation
Wolfram Research, Inc.
http://www.wolfram.com/


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


Mime
View raw message