source: release-kits/lirk3/resources/gs3-release-maker/ant/docs/manual/CoreTasks/basename.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 2.5 KB
Line 
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>
14Task to determine the basename of a specified file, optionally minus a
15specified suffix.
16</p>
17<p>
18When this task executes, it will set the specified property to the
19value of the last path element of the specified file. If <code>file</code> is a
20directory, the basename will be the last directory element. If
21<code>file</code> is a full-path, relative-path, or simple filename,
22the 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 &quot;<code>.</code>&quot;).</td>
46 <td valign="top" align="center">No</td>
47 </tr>
48</table>
49
50<h3>Examples</h3>
51<blockquote><pre>
52&lt;basename property=&quot;jar.filename&quot; file=&quot;${lib.jarfile}&quot;/&gt;
53</pre></blockquote>
54will set <code>jar.filename</code> to
55<code>myjar.jar</code>, if <code>lib.jarfile</code> is defined as either a
56full-path filename (eg., <code>/usr/local/lib/myjar.jar</code>),
57a relative-path filename (eg., <code>lib/myjar.jar</code>),
58or a simple filename (eg., <code>myjar.jar</code>).
59<blockquote><pre>
60&lt;basename property=&quot;cmdname&quot; file=&quot;D:/usr/local/foo.exe&quot;
61 suffix=&quot;.exe&quot;/&gt;
62</pre></blockquote>
63will set <code>cmdname</code> to <code>foo</code>.
64<blockquote><pre>
65&lt;property environment=&quot;env&quot;/&gt;
66&lt;basename property=&quot;temp.dirname&quot; file=&quot;${env.TEMP}&quot;/&gt;
67</pre></blockquote>
68
69will set <code>temp.dirname</code> to the last directory element of
70the path defined for the <code>TEMP</code> environment variable.</p>
71
72<hr>
73<p align="center">Copyright &copy; 2002,2004-2005 The Apache Software Foundation.
74All rights Reserved.</p>
75
76</body>
77</html>
78
Note: See TracBrowser for help on using the repository browser.