You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Glenn Kidd <GK...@placeware.com> on 2002/08/21 19:36:59 UTC

directory name?

What is the best way to get the current directory name, e.g. suppose I am located in "/home/bob/work/stuff", I want to be able to get "stuff" as a property.  What is the best way to achieve this?  Thanks in advance.


Glenn

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: directory name?

Posted by Diane Holt <ho...@yahoo.com>.
--- Ritesh Trivedi <ri...@embracenetworks.com> wrote:
> You can use ${basedir} property anywhere in the Ant build file which can
> be set to the current directory since its one of the attributes in the
> project element.

Actually ${basedir} doesn't necessarily represent the current working
directory, since the build file can be run from a directory other than
${basedir} (eg., via the -find flag), or 'basedir' may be set to some
directory other than where the build file actually lives.

Use ${user.dir} to get the current working directory. Use <basename> to
get the last element in the path.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: directory name?

Posted by Ritesh Trivedi <ri...@embracenetworks.com>.
You can use ${basedir} property anywhere in the Ant build file which can be
set to the current directory since its one of the attributes in the project
element.
Another way to get the current directory is to do the following

<property name="cwd" location="." />

Not tested but should work, since location substitues the value with the
absolute path on the system.

Thanks

Ritesh

================================
Ritesh Trivedi
Embrace Networks
408-585-5621
----- Original Message -----
From: "Glenn Kidd" <GK...@placeware.com>
To: "'Ant Users List'" <an...@jakarta.apache.org>
Sent: Wednesday, August 21, 2002 10:36 AM
Subject: directory name?


> What is the best way to get the current directory name, e.g. suppose I am
located in "/home/bob/work/stuff", I want to be able to get "stuff" as a
property.  What is the best way to achieve this?  Thanks in advance.
>
>
> Glenn
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>