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 RE: ReplaceRegExp with windows filenames
Date Fri, 26 Aug 2005 07:03:52 GMT
 
Hi,

-----Original Message-----
From: Neil Benn [mailto:neil.benn@gmail.com] 
Sent: Thursday, August 25, 2005 9:55 PM
To: Ant Users List
Subject: Re: ReplaceRegExp with windows filenames

/*
[...]

    So, it seems if I use ReplaceRegEx on the file or load the file
into a property and if I use one or two backslashes in the, I get out
something like this (either from an echo or in the file:

     [echo] 1 = ,"DropPaqEtc",,"C:Documents and SettingsNeil BennMy
Documentssvn_timtrunkDropPaq\installer\CE"   ; The etc directory which
contains all image and the jar file

[...]

*/

Sorry, didn't get your problem right, but maybe a point in
the right direction :

had a similar problem here with pathseparator ' \ ' on Windows =

in one antscript i grab one filename/path out of a directory with
antcontrib/timestampselector and echo that property to a file :

<path id="path.order">
            <fileset dir="${...}">
                <include name="*.txt" />
            </fileset>
        </path>
        <timestampselector property="order.candidat"
                           pathref="path.order"
                           count="1"
                           age="eldest">
        </timestampselector>

        <echo
file="C:/deployserver/path/to/mytxtfile/foobar.txt">${order.candidat}</e
cho>

in another script i load the property ${order.candidat} again, but as
the path
in that property on windows is something like :

C:\deployserver\path\to\mytxtfile\foobar.txt

the property gets C:deployserverpathtomytxtfilefoobar.txt when loaded
cause the ' \ ' is not masked (has to be ' \\ ' in java)

so i have to load it like that :

<loadfile property="auftragtxt"
srcfile="C:/deployserver/path/to/mytxtfile/foobar.txt">
<filterchain>
<replacestring from="\" to="/" />
</filterchain>
</loadfile>

and it get's loaded with ' / ' as pathseparator -> OK

btw, i always use ' / ' instead of ' \ ' even on windows (ant handles
that for you), 
because i noticed several strange things when using  ' \ ' on windows.

i even created a patch for the ant faq.xml and the ant manual /
property.html 
some time ago, but somehow no one noticed and it didn't get in.

http://marc.theaimsgroup.com/?l=ant-user&m=110769112325881&w=2

[ <faq id="win-backslashes"> ]

Regards, Gilbert

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


Mime
View raw message