You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dan Finkelstein <da...@nosimpler.com> on 2005/11/06 08:05:49 UTC
How to parse a directory path?
Hi --
I have a number of directories on which I wish to run the same ant build
file. I implemented something using <subant> and <dirlist> which
correctly calls a common build file for each directory. The problem is
that, when this build file is running, I need to know the name of the
directory it is running in.
For example, say, I have directories such as:
src/localization/fr
src/localization/de
src/localization/es
I would like a property to be set to "fr", "de" and "es", respectively,
so that my build file can act on this.
Can you suggest a solution for this?
Thanks much,
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: How to parse a directory path?
Posted by Andrew Goktepe <an...@gmail.com>.
You could use the <propertyregex> task from ant-contrib
http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html
Example (untested):
<property name="full.path.example" value="src/localization/fr"/>
<propertyregex property="dir.example" input="${full.path.example}"
regexp=".*/" replace=""/>
At this point the dir.example property has the value "fr".
-Andrew
On 11/6/05, Dan Finkelstein <da...@nosimpler.com> wrote:
>
> Hi --
>
> I have a number of directories on which I wish to run the same ant build
> file. I implemented something using <subant> and <dirlist> which
> correctly calls a common build file for each directory. The problem is
> that, when this build file is running, I need to know the name of the
> directory it is running in.
>
> For example, say, I have directories such as:
> src/localization/fr
> src/localization/de
> src/localization/es
>
> I would like a property to be set to "fr", "de" and "es", respectively,
> so that my build file can act on this.
>
> Can you suggest a solution for this?
>
> Thanks much,
> Dan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>