mirror of
https://github.com/apache/ant.git
synced 2025-05-18 14:04:48 +00:00
70 lines
2.3 KiB
HTML
70 lines
2.3 KiB
HTML
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Language" content="en-us">
|
||
|
<title>Basename Task</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<h2><a name="echo">Basename</a></h2>
|
||
|
<h3>Description</h3>
|
||
|
<p>
|
||
|
Task to determine the basename of a specified file, optionally minus a
|
||
|
specified suffix.
|
||
|
</p>
|
||
|
<p>
|
||
|
When this task executes, it will set the specified property to the
|
||
|
value of the last path element of the specified file. If <code>file</code> is a
|
||
|
directory, the basename will be the last directory element. If
|
||
|
<code>file</code> is a full-path, relative-path, or simple filename,
|
||
|
the basename will be the simple file name, without any directory elements.
|
||
|
</p>
|
||
|
<p>
|
||
|
<h3>Parameters</h3>
|
||
|
<table border="1" cellpadding="2" cellspacing="0">
|
||
|
<tr>
|
||
|
<td valign="top"><b>Attribute</b></td>
|
||
|
<td valign="top"><b>Description</b></td>
|
||
|
<td align="center" valign="top"><b>Required</b></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top">file</td>
|
||
|
<td valign="top">The path to take the basename of.</td>
|
||
|
<td valign="top" align="center">Yes</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top">property</td>
|
||
|
<td valign="top">The name of the property to set.</td>
|
||
|
<td valign="top" align="center">Yes</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top">suffix</td>
|
||
|
<td valign="top">The suffix to remove from the resulting basename
|
||
|
(specified either with or with the "<code>.</code>").</td>
|
||
|
<td valign="top" align="center">No</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<h3>Examples</h3>
|
||
|
<pre> <basename property="jar.filename" file="${lib.jarfile}"/></pre>
|
||
|
will set <code>jar.filename</code> to
|
||
|
<code>myjar.jar</code>, if <code>lib.jarfile</code> is defined as either a
|
||
|
full-path filename (eg., <code>/usr/local/lib/myjar.jar</code>),
|
||
|
a relative-path filename (eg., <code>lib/myjar.jar</code>),
|
||
|
or a simple filename (eg., <code>myjar.jar</code>).
|
||
|
<pre> <basename property="cmdname" file="D:/usr/local/foo.exe" suffix=".exe"/></pre>
|
||
|
will set <code>cmdname</code> to <code>foo</code>.
|
||
|
<pre> <basename property="temp.dirname" file="${env.TEMP}"/></pre>
|
||
|
|
||
|
will set <code>temp.dirname</code> to the last directory element of
|
||
|
the path defined for the <code>TEMP</code> environment variable.</p>
|
||
|
|
||
|
<hr>
|
||
|
<p align="center">Copyright © 2002 Apache Software Foundation.
|
||
|
All rights Reserved.</p>
|
||
|
|
||
|
</body>
|
||
|
</html>
|
||
|
|