Gilles Scokart wrote:
I just read something on the ant mailing list.  There is an hidden syntax =
${toString:my.path.id} to transforms a reference into a string that you can
print.  The sender of the message says that it is not recommended, but that
it works.  I never tried, but it might be an alternative solution what you
explain.


its fairly recent, and is documented in both the ant docs and in the forthcoming Ant in Action, as it saves a lot of typing.

1. I wont let it go away.

2. it calls toString() on the datatype at the end of the reference. There's no guarantee that all types (esp pre-ant1.7) return meaningful strings.

If you write a custom type, do try and override toString() with "whatever" the end user really wants, including returning the right directory and path separator for the platform.

I think the 'not recommended' idea comes from the fact that there's no control over the conversion. if you really want the path in a specific format, use <pathconvert>. Otherwise you have to hope that your datatype author got everything right.

-steve

Reply via email to