SCRATCH all that. ANT deal with backslash like a champ, doesn't use it as an
escape character, and path/location of <pathelement> are equivalent in the
example below. Not like experimentation before talking ;-) --DD

P:\org_apache\antx>ant -f backslash.xml
Buildfile: backslash.xml

test:
     [echo] This is a message
     [echo] This \is \a \message
     [echo] path1 = C:\winnt\System32;C:\winnt
     [echo] path2 = C:\winnt\System32;C:\winnt
     [echo] path3 = C:\winnt\System32;C:\winnt
     [echo] path4 = C:\winnt\System32;C:\winnt
     [echo] path5 = C:\winnt\System32;C:\winnt
     [echo] path6 = C:\winnt\System32;C:\winnt

BUILD SUCCESSFUL

Total time: 0 seconds

<?xml version="1.0"?>

<!-- ANT build file to test a specific feature or bug of ANT.
     Dominique Devienne <[EMAIL PROTECTED]>         May 2002
  -->
<project name="backslash" default="test" basedir=".">

  <path id="path1-id">
    <pathelement location="C:\winnt\System32" />
    <pathelement location="C:\winnt" />
  </path>
  <property name="path1" refid="path1-id" />

  <path id="path2-id">
    <pathelement location="C:/winnt/System32" />
    <pathelement location="C:/winnt" />
  </path>
  <property name="path2" refid="path2-id" />

  <path id="path3-id">
    <pathelement path="C:\winnt\System32" />
    <pathelement path="C:\winnt" />
  </path>
  <property name="path3" refid="path3-id" />

  <path id="path4-id">
    <pathelement path="C:/winnt/System32" />
    <pathelement path="C:/winnt" />
  </path>
  <property name="path4" refid="path4-id" />

  <path id="path5-id">
    <pathelement path="C:/winnt/System32;C:/winnt" />
  </path>
  <property name="path5" refid="path5-id" />

  <path id="path6-id">
    <pathelement path="C:\winnt\System32;C:\winnt" />
  </path>
  <property name="path6" refid="path6-id" />

  <target name="test">
    <echo message="This is a message" />
    <echo message="This \is \a \message" />
    <echo message="path1 = ${path1}" />
    <echo message="path2 = ${path2}" />
    <echo message="path3 = ${path3}" />
    <echo message="path4 = ${path4}" />
    <echo message="path5 = ${path5}" />
    <echo message="path6 = ${path6}" />
  </target>

</project>

-----Original Message-----
From: Dominique Devienne [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, May 02, 2002 9:27 AM
To: 'Ant Users List'
Subject: RE: How do I specify multiple Windows directories in one <propert y
name> statement?

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:[EMAIL PROTECTED]] 
Sent: Wednesday, May 01, 2002 9:54 PM
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to