source: other-projects/trunk/realistic-books/packages/AntInstaller/web/manual/manual/CoreTasks/basename.html@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 3.2 KB
Line 
1<!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<html>
18
19<head>
20<meta http-equiv="Content-Language" content="en-us">
21<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
22<title>Basename Task</title>
23</head>
24
25<body>
26
27<h2><a name="echo">Basename</a></h2>
28<h3>Description</h3>
29<p>
30Task to determine the basename of a specified file, optionally minus a
31specified suffix.
32</p>
33<p>
34When this task executes, it will set the specified property to the
35value of the last path element of the specified file. If <code>file</code> is a
36directory, the basename will be the last directory element. If
37<code>file</code> is a full-path, relative-path, or simple filename,
38the basename will be the simple file name, without any directory elements.
39</p>
40<p>
41<h3>Parameters</h3>
42<table border="1" cellpadding="2" cellspacing="0">
43 <tr>
44 <td valign="top"><b>Attribute</b></td>
45 <td valign="top"><b>Description</b></td>
46 <td align="center" valign="top"><b>Required</b></td>
47 </tr>
48 <tr>
49 <td valign="top">file</td>
50 <td valign="top">The path to take the basename of.</td>
51 <td valign="top" align="center">Yes</td>
52 </tr>
53 <tr>
54 <td valign="top">property</td>
55 <td valign="top">The name of the property to set.</td>
56 <td valign="top" align="center">Yes</td>
57 </tr>
58 <tr>
59 <td valign="top">suffix</td>
60 <td valign="top">The suffix to remove from the resulting basename
61 (specified either with or without the &quot;<code>.</code>&quot;).</td>
62 <td valign="top" align="center">No</td>
63 </tr>
64</table>
65
66<h3>Examples</h3>
67<blockquote><pre>
68&lt;basename property=&quot;jar.filename&quot; file=&quot;${lib.jarfile}&quot;/&gt;
69</pre></blockquote>
70will set <code>jar.filename</code> to
71<code>myjar.jar</code>, if <code>lib.jarfile</code> is defined as either a
72full-path filename (eg., <code>/usr/local/lib/myjar.jar</code>),
73a relative-path filename (eg., <code>lib/myjar.jar</code>),
74or a simple filename (eg., <code>myjar.jar</code>).
75<blockquote><pre>
76&lt;basename property=&quot;cmdname&quot; file=&quot;D:/usr/local/foo.exe&quot;
77 suffix=&quot;.exe&quot;/&gt;
78</pre></blockquote>
79will set <code>cmdname</code> to <code>foo</code>.
80<blockquote><pre>
81&lt;property environment=&quot;env&quot;/&gt;
82&lt;basename property=&quot;temp.dirname&quot; file=&quot;${env.TEMP}&quot;/&gt;
83</pre></blockquote>
84
85will set <code>temp.dirname</code> to the last directory element of
86the path defined for the <code>TEMP</code> environment variable.</p>
87
88
89
90</body>
91</html>
92
Note: See TracBrowser for help on using the repository browser.