ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject yet another problem with windows and '\'
Date Tue, 26 Jul 2005 09:51:11 GMT

Hi,

if someone else runs into that ...

i just had another unpleasant experience with windows
pathdelimiter  ' \ ' in ant (usually i always write / instead
of \ , but in that special case)

I've set a property via antcontrib / timestampselector
and wrote it to a file to use it in another antscript later.
...
<path id="path.order">
            <fileset dir="${order.txt}">
                <include name="*.txt" />
            </fileset>
        </path>
        <timestampselector property="order.candidat"
                           pathref="path.order"
                           count="1"
                           age="eldest">
        </timestampselector>

        <echo
file="C:/cc_ant_workdir/temp.ordertxt">order.target=${order.candidat}</e
cho>
...
that writes 
order.target=C:/path/to/my/txtfile 
into temp.ordertxt

when using the property order.target via property file=temp.ordertxt
later the property get's expanded as =
C:pathtomytxtfile

Oops :-(  
behaviour as in java when \ has to be masked as \\

*** What's the reason for that ? ***

So i choosed a workaround via
<echo file="C:/cc_ant_workdir/temp.ordertxt">${order.candidat}</echo>
and later
<loadfile property="order.target"
srcfile="C:/cc_ant_workdir/temp.ordertxt">
	<filterchain>
		<replacestring from="\" to="/" />
	</filterchain>
</loadfile>

Gilbert

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


Mime
View raw message