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.

dirname.html 2.5 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Dirname Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="echo">Dirname</a></h2>
  23. <h3>Description</h3>
  24. <p>
  25. Task to determine the directory path of a specified file.
  26. </p>
  27. <p>
  28. When this task executes, it will set the specified property to the
  29. value of the specified file (or directory) up to, but not including,
  30. the last path element. If the specified file is a path that ends in a
  31. filename, the filename will be dropped. If the specified file is just
  32. a filename, the directory will be the current directory.
  33. </p>
  34. <p>
  35. <em>Note:</em> This is not the same as the UNIX dirname command, which is
  36. defined as "strip non-directory suffix from filename". &lt;dirname&gt;
  37. determines the full directory path of the specified file.
  38. </p>
  39. <h3>Parameters</h3>
  40. <table border="1" cellpadding="2" cellspacing="0">
  41. <tr>
  42. <td valign="top"><b>Attribute</b></td>
  43. <td valign="top"><b>Description</b></td>
  44. <td align="center" valign="top"><b>Required</b></td>
  45. </tr>
  46. <tr>
  47. <td valign="top">file</td>
  48. <td valign="top">The path to take the dirname of.</td>
  49. <td valign="top" align="center">Yes</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">property</td>
  53. <td valign="top">The name of the property to set.</td>
  54. <td valign="top" align="center">Yes</td>
  55. </tr>
  56. </table>
  57. <h3>Examples</h3>
  58. <pre> &lt;dirname property=&quot;antfile.dir&quot; file=&quot;${ant.file}&quot;/&gt;</pre>
  59. will set <code>antfile.dir</code> to the directory path for
  60. <code>${ant.file}</code>.
  61. <pre> &lt;dirname property=&quot;foo.dirname&quot; file=&quot;foo.txt&quot;/&gt;</pre>
  62. will set <code>foo.dirname</code> to the project's basedir.</p>
  63. </body>
  64. </html>