I have an Ant xml file. In this file I want to set two properties based on the current working directory. The current working directory is always of the form /some/base/dir/SRC/sub/dir
.
The first property must be set to the current working directory. The second property must be set to the part of the current working directory up to /SRC
.
I can set the first property without any issue using the PWD
environment variable , but I cannot figure out the second.
<property name="my.dir" value="${env.PWD}" />
<property name="src.dir" value="{what do I put here?}" />
I've heard this can be done with bash-style string manipulation (e.g. ${PWD%*/SRC}/SRC
) using StringOps, but I cannot find any good examples.