Have you considered doing something with <dirname> ???

That should give you the desired value...

On Fri, 23 May 2008, Cyril Sagan wrote:

Has anyone else ever wished there was a way to specify "location semantics" for 
<condition/> values?

Given that doesn't exist, can anyone suggest the ideal way to implement:

  $ cd /tmp/X/Y/script/
  $ cat build.xml
  <?xml version="1.0" encoding="utf-8"?>
  <project name="ant_dev_sample">
      <property name="tmp.path"  location="${basedir}/../.." />
      <condition property="some.dir" value="${tmp.path}">
          <isset property="some.property" />
      </condition>
      <echo>some.dir: ${some.dir}</echo>
  </project>

  $ ant -Dsome.property=true
  Buildfile: build.xml
       [echo] some.dir: /tmp/X

  BUILD SUCCESSFUL
  Total time: 0 seconds



This is exactly what I want, a full and resolved path.
However, without the property, I get a relative path, not ideal.

  $ cat build.xml
  <?xml version="1.0" encoding="utf-8"?>
  <project name="ant_dev_sample2">
      <condition property="some.dir" value="${basedir}/../..">
          <isset property="some.property" />
      </condition>
      <echo>some.dir: ${some.dir}</echo>
  </project>

  $ ant -Dsome.property=true
  Buildfile: build.xml
       [echo] some.dir: /tmp/X/Y/script/../..

  BUILD SUCCESSFUL
  Total time: 0 seconds

                       ^^^^^^^^^^^^^^^^^^^^^^^^^ Yuck!


Thanks in advance for your more elegant solution!

--Cyril


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



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

Reply via email to