You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

basename.html 2.3 KiB

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