You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by mindspin311 <co...@gmail.com> on 2008/03/31 21:51:30 UTC
Need to find current directory (not entire path)
If I have the following path: /blah/foo/trunk/
I want to be able to assign just "trunk" to a property, similar to dirname:
<dirname property="pdir" file="build.xml" />
This returns the whole path. I just want it to return the last element of a
directory.
--
View this message in context: http://www.nabble.com/Need-to-find-current-directory-%28not-entire-path%29-tp16399048p16399048.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Need to find current directory (not entire path)
Posted by Matt Benson <gu...@yahoo.com>.
Ant 1.7.0 introduced resource collections including
<tokens> and <string>:
<tokens id="tokens">
<string value="At revision 100" />
<stringtokenizer />
</tokens>
With svn trunk/Ant 1.7.1 (beta will probably be
released soon), you can wrap tokens with <last>:
<last>
<resources refid="tokens" />
</last>
HTH,
Matt
--- Francis Brennan <fb...@adobe.com> wrote:
> There is a propertyregex task in ant-contrib that
> you can use to extract
> part of a property's value to a new property.
>
> -----Original Message-----
> From: mindspin311 [mailto:connoc.mindspin@gmail.com]
>
> Sent: Monday, March 31, 2008 2:33 PM
> To: user@ant.apache.org
> Subject: Re: Need to find current directory (not
> entire path)
>
>
> Wow, completely overlooked basename, but that only
> really solves this
> specific problem. I was really hoping to find out if
> there was a way to
> parse a string or property. Let's say I'm using svn
> update and it
> returns 'At revision 100'. I put that string into a
> property.
>
> Now, how do I extract just the 100?
>
> Is there any built in functionality that will solve
> this, or do I have
> to make my own task to handle something like this?
>
>
>
>
>
> mindspin311 wrote:
> >
> > If I have the following path: /blah/foo/trunk/
> >
> > I want to be able to assign just "trunk" to a
> property, similar to
> > dirname:
> >
> > <dirname property="pdir" file="build.xml" />
> >
> > This returns the whole path. I just want it to
> return the last element
>
> > of a directory.
> >
> >
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Need-to-find-current-directory-%28not-entire-path%
> 29-tp16399048p16399100.html
> Sent from the Ant - Users mailing list archive at
> Nabble.com.
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Need to find current directory (not entire path)
Posted by Francis Brennan <fb...@adobe.com>.
There is a propertyregex task in ant-contrib that you can use to extract
part of a property's value to a new property.
-----Original Message-----
From: mindspin311 [mailto:connoc.mindspin@gmail.com]
Sent: Monday, March 31, 2008 2:33 PM
To: user@ant.apache.org
Subject: Re: Need to find current directory (not entire path)
Wow, completely overlooked basename, but that only really solves this
specific problem. I was really hoping to find out if there was a way to
parse a string or property. Let's say I'm using svn update and it
returns 'At revision 100'. I put that string into a property.
Now, how do I extract just the 100?
Is there any built in functionality that will solve this, or do I have
to make my own task to handle something like this?
mindspin311 wrote:
>
> If I have the following path: /blah/foo/trunk/
>
> I want to be able to assign just "trunk" to a property, similar to
> dirname:
>
> <dirname property="pdir" file="build.xml" />
>
> This returns the whole path. I just want it to return the last element
> of a directory.
>
>
>
>
>
--
View this message in context:
http://www.nabble.com/Need-to-find-current-directory-%28not-entire-path%
29-tp16399048p16399100.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Need to find current directory (not entire path)
Posted by mindspin311 <co...@gmail.com>.
Wow, completely overlooked basename, but that only really solves this
specific problem. I was really hoping to find out if there was a way to
parse a string or property. Let's say I'm using svn update and it returns
'At revision 100'. I put that string into a property.
Now, how do I extract just the 100?
Is there any built in functionality that will solve this, or do I have to
make my own task to handle something like this?
mindspin311 wrote:
>
> If I have the following path: /blah/foo/trunk/
>
> I want to be able to assign just "trunk" to a property, similar to
> dirname:
>
> <dirname property="pdir" file="build.xml" />
>
> This returns the whole path. I just want it to return the last element of
> a directory.
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Need-to-find-current-directory-%28not-entire-path%29-tp16399048p16399100.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Need to find current directory (not entire path)
Posted by "Scot P. Floess" <fl...@mindspring.com>.
Try <basename>
mindspin311 wrote:
> If I have the following path: /blah/foo/trunk/
>
> I want to be able to assign just "trunk" to a property, similar to dirname:
>
> <dirname property="pdir" file="build.xml" />
>
> This returns the whole path. I just want it to return the last element of a
> directory.
>
>
>
>
>
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
Architect Keros http://sourceforge.net/projects/keros
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Need to find current directory (not entire path)
Posted by Peter Reilly <pe...@gmail.com>.
<dirname property="pdir" file="build.xml" />
<basename property="dirname" file="${pdir}"/>
Peter
On Mon, Mar 31, 2008 at 8:51 PM, mindspin311 <co...@gmail.com> wrote:
>
> If I have the following path: /blah/foo/trunk/
>
> I want to be able to assign just "trunk" to a property, similar to dirname:
>
> <dirname property="pdir" file="build.xml" />
>
> This returns the whole path. I just want it to return the last element of a
> directory.
>
>
>
>
> --
> View this message in context: http://www.nabble.com/Need-to-find-current-directory-%28not-entire-path%29-tp16399048p16399048.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org