opensubscriber
   Find in this group all groups
 
Unknown more information…

u : user@ant.apache.org 8 September 2009 • 2:41PM -0400

calculating relative paths
by Andy Stevens

REPLY TO AUTHOR
 
REPLY TO GROUP




Hi,

Is there an easy way to calculate an arbitrary relative path between two files?
Part of my Ant script copies a default configuration file to a build
folder, in the course of which I modify it (with xmltask) with the
location of some source files.  At the moment I'm using <property
location="${src.dir}" .../> to get the absolute path, but I'm curious
whether there's a way to get a relative path instead .  Since I know
where it's being copied to, I could just use "../../${src.dir}", but
that's a bit fragile if the build directory changes (which it will do
- locally on my machine I use ${basedir}/build, but on our CI server
it's likely to override this with some other directory).
Ideally, I suppose I'd like to use something like <property
location="${src.dir}" basedir="${build.dir}" .../>  Is there anything
like this in one of the "extras" libraries, or some other easy way to
achieve it?


Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant....
For additional commands, e-mail: user-help@ant....

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.