I have many different HTML files in different directories. I'm already using
the <copy> task with a <filterset> to replace tokens in these files. I'm
trying to figure out how to create a token like @ROOTPATH@ that will always
resolve to the proper number of "../" patterns to get from the current
directory to the root of the directory tree. This would be used for
example, like this:
<a href="@ROOTPATH@/foo/bar.html">some link</a>
In a file that then gets included into lots of other files in lots of
different directories. So the value of @ROOTPATH@ needs to be different
depending upon the directory in which file containing it is located. I am
unable to use absolute directory paths because this HTML is only read off of
a user's local disk instead of a webserver and an absolute path beginning at
the user's C: drive (or / if on Unix) isn't acceptable. My ant build tasks
use <replaceregexp> to simulate SSI <!--#include --> to get the contents of
these files (like the banner) into all the other files.
I've tried using this:
<for param="currentDir">
<path>
<dirset dir="${rootPath}"/>
</path>
<sequential>
<propertyregex property="currentDirForwardSlashes"
input="@{currentDir}" regexp="\\" replace="/" defaultvalue="@{currentDir}"
override="true"/>
<echo message="Path: ${currentDirForwardSlashes}"/>
</sequential>
</for>
But the path always comes back fully-qualified and I can't figure out how to
truncate the ${rootPath} poriton of the path off the front of the path and
then change the remaining directories in the path to ".."
I've also tried using a recursive technique with <dirset includes="*"> so I
only get one level at a time and then recursively call my task appending
"../" to a parameter. However, I'm getting an error that <antcall> can't
call tasks recursively.
Does anyone have any ideas?
--
View this message in context:
http://www.nabble.com/Inserting-different-relative-paths-into-multiple-files-using-the-same-token-tp20411245p20411245.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]