I added that in rev812881.
So it should be available with Ant 1.8.0 this year.
Jan
<!-- Ensure we have platform dependent path separator -->
<property name="base" location="${basedir}"/>
<!-- an existing file as anchor for calculating paths -->
<property name="testfile"
value="condition${file.separator}antversion-test.xml"/>
<target name="testLocation">
<property name="foo" location="${testfile}"/>
<au:assertPropertyEquals name="foo"
value="${base}${file.separator}${testfile}"/>
</target>
<target name="testLocationWithRecursive">
<property name="foo" location="${testfile}" relative="false"/>
<au:assertPropertyEquals name="foo"
value="${base}${file.separator}${testfile}"/>
</target>
<target name="testRelative">
<property name="foo" location="${testfile}" relative="true"/>
<au:assertPropertyEquals name="foo" value="${testfile}"/>
</target>
<target name="testRelativeBase">
<property name="foo" location="${testfile}" relative="true"
basedir="${base}"/>
<au:assertPropertyEquals name="foo" value="${testfile}"/>
</target>
<target name="testRelativeUnderBase">
<property name="foo" location="${testfile}" relative="true"
basedir="condition"/>
<au:assertPropertyEquals name="foo" value="antversion-test.xml"/>
</target>
<target name="testRelativeUnderBase2">
<property name="foo" location="${testfile}" relative="true" basedir="cvs"/>
<au:assertPropertyEquals name="foo"
value="..${file.separator}condition${file.separator}antversion-test.xml"/>
</target>
<target name="testRelativeOverBase">
<property name="foo" location="${testfile}" relative="true" basedir=".."/>
<au:assertPropertyEquals name="foo"
value="taskdefs${file.separator}${testfile}"/>
</target>
>-----Ursprüngliche Nachricht-----
>Von: [email protected] [mailto:[email protected]]
>Gesendet: Mittwoch, 9. September 2009 11:30
>An: [email protected]
>Betreff: AW: calculating relative paths
>
>>Perhaps I should raise an enhancement request. A couple of new
>>attributes "relative" (default false) and "basedir" (default
>>${basedir}) that can be used in conjunction with the "location"
>>attribute seem a relatively minor addition, and would reduce my
>>problem to <property name="relpath" location="${src.dir}"
>>relative="true" basedir="${build.dir}/xsltdoc"/>
>>Any of the developers care to comment?
>
>The enhancement of <property location/> seems to be good candidate.
>
>
><property value="my/file.txt"/>
>--> my/file.txt
>
><property location="my/file.txt"/>
>--> path/to/projectbasedir/my/file.txt
>
><property location="my/file.txt" relative="true"/>
>--> my/file.txt
>
><property location="my/file.txt" relative="true" basedir="my"/>
>--> file.txt
>
><property location="my/file.txt" relative="true" basedir="my/dir"/>
>--> ../my/file.txt
>
><property location="my/file.txt" relative="true" basedir=".."/>
>--> projectbasedir/my/file.txt
>
>
>Jan
>
>---------------------------------------------------------------------
>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]