ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: AW: [Maybe spam] Re: using file names
Date Wed, 13 Apr 2005 11:53:38 GMT
Hello, I am not sure if this will do your job, but
here is a working snippet.
<project>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<for param="file">
  <path>
    <fileset dir="${basedir}" includes="*.xml"/>
  </path>
  <sequential>
    <basename file="@{file}"
property="@{file}.basename"/>
    <echo>basename is ${@{file}.basename}</echo>
  </sequential>
</for>
</project>

Here we bump in the following issue: ant properties
are immutable so if we use basename in the following
way
<basename file="@{file}" property="basename"/>
the first iteration of <for> will set a property named
 "basename" and all other resets of this property in
the next iteration will have no effect. That is why we
append the absolute name of the file to the name of
the  property to ensure uniqueness of the proeprties'
names.

However, I do not like this solution, because <for> is
not "the Ant way of doing things" so think twice
before using it. Could you provide more information
what are you trying to achieve with <for> and
<uptodate>; a better idea might come up.

HTH Ivan

--- Huditsch Roman <Roman.Huditsch@lexisnexis.at>
wrote:
> Ah, I see.
> But how can I incorporate it into an <uptodate>
> statement?
> 
> <uptodate property="copy.notRequired"
> srcfile="@{file}">
> 	<!-- How to specify my @targetfile correctly? -->
> </uptodate>
>  
> I would like to test @{file} againt the same
> basename within the "result" directory....
> 
> I tried it first with "result/@{file}" which gave me
> "result/c:\Programme\test.xml".
> 
> I also tried 
> <uptodate property="copy.notRequired"
> srcfile="@{file}">
> 	<mapper>
> 		<flattenmapper/>
> 		<globmapper from="*" to="result/*"/>
> 	</mapper>
> </uptodate>
> but with no success either....
> 
> Thanks for the help!
> 
> wbr,
> Roman



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

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


Mime
View raw message