ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: How do I specify multiple Windows directories in one <propert y name> statement?
Date Thu, 02 May 2002 14:26:58 GMT
Just do it the right ANT way, by using relative directories, <path>, and
convert it to a property (at least IMHO):

1) Assuming your build file is in C:\project\

<project name="whatever" basedir=".">

    <path id="test-path-id">
      <pathelement location="src1" />
      <pathelement location="src2" />
    </path>
    <property name="test.path"
              refid="test-path-id" />

</project>

The location attribute of <pathelement> is relative to basedir of <project>
when the specified path in not absolute.

2) If your two directories are unrelated to your projects (then why would
you path src/ dirs in the path!?!?!?), then is should be

    <path id="test-path-id">
      <pathelement path="C:/project/src1" /> <!-- path or location? -->
      <pathelement path="C:/project/src2" /> <!-- Diane? Stefan? -->
    </path>
    <property name="test.path"
              refid="test-path-id" />

In case ANT gets confused by the C:, thinking the colon is a path separator
(which I don't think it should), you can still omit it entirely, and use
<pathconvert> to put it back, use /C_colon and replace to C:...

3) Finally, maybe the only answer you wanted:

    <property name="test.path"
              value="C:/project/src1;C:/project/src2" />

PS: Always use forward slashes in ANT, as back slash is the XML escape
character, and ANT takes care of converting it correctly for the current
platform, and <pathconvert> converts it to a different target platform if
needed!

-----Original Message-----
From: Tony [mailto:s4565@lycos.co.uk] 
Sent: Wednesday, May 01, 2002 9:54 PM
To: ant-user@jakarta.apache.org
Subject: How do I specify multiple Windows directories in one <property
name> statement?

Hi Folks

How do I write the line below for Windows

<property name="test.path" value="/home/project/src1:/home/project/src2"/>

this time

SRC1_DIR=C:\project\src1
SRC2_DIR=C:\project\src2

If I write

<property name="test.path" value="C:\project\src1:C:\project\src2"/>

then this is clearly wrong since Windows uses ":" in its paths names.  So
can someone please tell me how I write this in Widows.

Cheers

Tony

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

--
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