1 | <html>
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
5 | <title>Basename Task</title>
|
---|
6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 |
|
---|
11 | <h2><a name="echo">Basename</a></h2>
|
---|
12 | <h3>Description</h3>
|
---|
13 | <p>
|
---|
14 | Task to determine the basename of a specified file, optionally minus a
|
---|
15 | specified suffix.
|
---|
16 | </p>
|
---|
17 | <p>
|
---|
18 | When this task executes, it will set the specified property to the
|
---|
19 | value of the last path element of the specified file. If <code>file</code> is a
|
---|
20 | directory, the basename will be the last directory element. If
|
---|
21 | <code>file</code> is a full-path, relative-path, or simple filename,
|
---|
22 | the basename will be the simple file name, without any directory elements.
|
---|
23 | </p>
|
---|
24 | <p>
|
---|
25 | <h3>Parameters</h3>
|
---|
26 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
27 | <tr>
|
---|
28 | <td valign="top"><b>Attribute</b></td>
|
---|
29 | <td valign="top"><b>Description</b></td>
|
---|
30 | <td align="center" valign="top"><b>Required</b></td>
|
---|
31 | </tr>
|
---|
32 | <tr>
|
---|
33 | <td valign="top">file</td>
|
---|
34 | <td valign="top">The path to take the basename of.</td>
|
---|
35 | <td valign="top" align="center">Yes</td>
|
---|
36 | </tr>
|
---|
37 | <tr>
|
---|
38 | <td valign="top">property</td>
|
---|
39 | <td valign="top">The name of the property to set.</td>
|
---|
40 | <td valign="top" align="center">Yes</td>
|
---|
41 | </tr>
|
---|
42 | <tr>
|
---|
43 | <td valign="top">suffix</td>
|
---|
44 | <td valign="top">The suffix to remove from the resulting basename
|
---|
45 | (specified either with or without the "<code>.</code>").</td>
|
---|
46 | <td valign="top" align="center">No</td>
|
---|
47 | </tr>
|
---|
48 | </table>
|
---|
49 |
|
---|
50 | <h3>Examples</h3>
|
---|
51 | <pre> <basename property="jar.filename" file="${lib.jarfile}"/></pre>
|
---|
52 | will set <code>jar.filename</code> to
|
---|
53 | <code>myjar.jar</code>, if <code>lib.jarfile</code> is defined as either a
|
---|
54 | full-path filename (eg., <code>/usr/local/lib/myjar.jar</code>),
|
---|
55 | a relative-path filename (eg., <code>lib/myjar.jar</code>),
|
---|
56 | or a simple filename (eg., <code>myjar.jar</code>).
|
---|
57 | <pre> <basename property="cmdname" file="D:/usr/local/foo.exe" suffix=".exe"/></pre>
|
---|
58 | will set <code>cmdname</code> to <code>foo</code>.
|
---|
59 | <pre> <property environment="env"/>
|
---|
60 | <basename property="temp.dirname" file="${env.TEMP}"/></pre>
|
---|
61 |
|
---|
62 | will set <code>temp.dirname</code> to the last directory element of
|
---|
63 | the path defined for the <code>TEMP</code> environment variable.</p>
|
---|
64 |
|
---|
65 | <hr>
|
---|
66 | <p align="center">Copyright © 2002,2004 The Apache Software Foundation.
|
---|
67 | All rights Reserved.</p>
|
---|
68 |
|
---|
69 | </body>
|
---|
70 | </html>
|
---|
71 |
|
---|