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>
|
---|
30 | Task to determine the basename of a specified file, optionally minus a
|
---|
31 | specified suffix.
|
---|
32 | </p>
|
---|
33 | <p>
|
---|
34 | When this task executes, it will set the specified property to the
|
---|
35 | value of the last path element of the specified file. If <code>file</code> is a
|
---|
36 | directory, the basename will be the last directory element. If
|
---|
37 | <code>file</code> is a full-path, relative-path, or simple filename,
|
---|
38 | the 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 "<code>.</code>").</td>
|
---|
62 | <td valign="top" align="center">No</td>
|
---|
63 | </tr>
|
---|
64 | </table>
|
---|
65 |
|
---|
66 | <h3>Examples</h3>
|
---|
67 | <blockquote><pre>
|
---|
68 | <basename property="jar.filename" file="${lib.jarfile}"/>
|
---|
69 | </pre></blockquote>
|
---|
70 | will set <code>jar.filename</code> to
|
---|
71 | <code>myjar.jar</code>, if <code>lib.jarfile</code> is defined as either a
|
---|
72 | full-path filename (eg., <code>/usr/local/lib/myjar.jar</code>),
|
---|
73 | a relative-path filename (eg., <code>lib/myjar.jar</code>),
|
---|
74 | or a simple filename (eg., <code>myjar.jar</code>).
|
---|
75 | <blockquote><pre>
|
---|
76 | <basename property="cmdname" file="D:/usr/local/foo.exe"
|
---|
77 | suffix=".exe"/>
|
---|
78 | </pre></blockquote>
|
---|
79 | will set <code>cmdname</code> to <code>foo</code>.
|
---|
80 | <blockquote><pre>
|
---|
81 | <property environment="env"/>
|
---|
82 | <basename property="temp.dirname" file="${env.TEMP}"/>
|
---|
83 | </pre></blockquote>
|
---|
84 |
|
---|
85 | will set <code>temp.dirname</code> to the last directory element of
|
---|
86 | the path defined for the <code>TEMP</code> environment variable.</p>
|
---|
87 |
|
---|
88 |
|
---|
89 |
|
---|
90 | </body>
|
---|
91 | </html>
|
---|
92 |
|
---|