| <html devsite> |
| <head> |
| <meta name="project_path" value="/_project.yaml"> |
| <meta name="book_path" value="/versions/7.4.0/_book.yaml"> |
| </head> |
| <body> |
| |
| <h1 class="page-title" id="modules.path">path</h1> |
| |
| {% dynamic setvar source_file "src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkPath.java" %} |
| {% dynamic setvar version "7.4.0" %} |
| {% dynamic setvar original_path "/rules/lib/builtins/path" %} |
| {% include "_buttons.html" %} |
| <!-- {% raw %} --> |
| |
| A structure representing a file to be used inside a repository. |
| |
| <h2>Members</h2> |
| <ul> |
| <li> |
| <a href="#basename">basename</a> |
| </li> |
| <li> |
| <a href="#dirname">dirname</a> |
| </li> |
| <li> |
| <a href="#exists">exists</a> |
| </li> |
| <li> |
| <a href="#get_child">get_child</a> |
| </li> |
| <li> |
| <a href="#is_dir">is_dir</a> |
| </li> |
| <li> |
| <a href="#readdir">readdir</a> |
| </li> |
| <li> |
| <a href="#realpath">realpath</a> |
| </li> |
| </ul> |
| |
| <h2 id="basename">basename</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../core/string.html">string</a> path.basename</pre></p> |
| |
| A string giving the basename of the file. |
| |
| |
| <h2 id="dirname">dirname</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../builtins/path.html">path</a> path.dirname</pre></p> |
| |
| The parent directory of this file, or None if this file does not have a parent. |
| |
| May return <code>None</code>. |
| |
| <h2 id="exists">exists</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> path.exists</pre></p> |
| |
| Returns true if the file or directory denoted by this path exists.<p>Note that accessing this field does <em>not</em> cause the path to be watched. If you'd like the repo rule or module extension to be sensitive to the path's existence, use the <code>watch()</code> method on the context object. |
| |
| |
| |
| <h2 id="get_child">get_child</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../builtins/path.html">path</a> path.get_child(*relative_paths)</pre></p> |
| |
| Returns the path obtained by joining this path with the given relative paths. |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="get_child.relative_paths"> |
| <code>relative_paths</code> |
| </td> |
| <td> |
| required<br/> |
| Zero or more relative path strings to append to this path with path separators added as needed. |
| |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="is_dir">is_dir</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../core/bool.html">bool</a> path.is_dir</pre></p> |
| |
| Returns true if this path points to a directory.<p>Note that accessing this field does <em>not</em> cause the path to be watched. If you'd like the repo rule or module extension to be sensitive to whether the path is a directory or a file, use the <code>watch()</code> method on the context object. |
| |
| |
| |
| <h2 id="readdir">readdir</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../core/list.html">list</a> path.readdir(watch='auto')</pre></p> |
| |
| Returns the list of entries in the directory denoted by this path. Each entry is a <code>path</code> object itself. |
| |
| |
| <!-- hide-from-toc is a class used by DevSite for the public Bazel site |
| (https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) --> |
| <h3 class="hide-from-toc">Parameters</h3> |
| <table class="table table-bordered table-condensed table-params"> |
| <colgroup> |
| <col class="col-param"> |
| <col class="param-description"> |
| </colgroup> |
| <thead> |
| <tr> |
| <th>Parameter</th> |
| <th>Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td id="readdir.watch"> |
| <code>watch</code> |
| </td> |
| <td> |
| default is <code>'auto'</code><br/> |
| whether Bazel should watch the list of entries in this directory and refetch the repository or re-evaluate the module extension next time when any changes are detected. Changes to detect include entry creation, deletion, and renaming. Note that this doesn't watch the <em>contents</em> of any entries in the directory.<p>Can be the string 'yes', 'no', or 'auto'. If set to 'auto', Bazel will only watch this directory when it is legal to do so (see <a href="repository_ctx.html#watch"><code>repository_ctx.watch()</code></a> docs for more information). |
| |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <h2 id="realpath">realpath</h2> |
| <p><pre class="rule-signature"><a class="anchor" href="../builtins/path.html">path</a> path.realpath</pre></p> |
| |
| Returns the canonical path for this path by repeatedly replacing all symbolic links with their referents. |
| |
| |
| |
| |
| </body> |
| </html> |
| |
| <!-- {% endraw %} --> |