docs/versions/6.5.0/rules/lib/path.mdx
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="#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="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="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="bool.html">bool</a> path.exists</pre></p>
Returns true if the file denoted by this path exists.
<h2 id="get_child">get_child</h2>
<p><pre class="rule-signature"><a class="anchor" href="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
Zero or more relative path strings to append to this path with path separatorsadded as needed.
</td>
</tr>
</tbody>
</table>
<h2 id="readdir">readdir</h2>
<p><pre class="rule-signature"><a class="anchor" href="list.html">list</a> path.readdir()</pre></p>
The list of entries in the directory denoted by this path.
<h2 id="realpath">realpath</h2>
<p><pre class="rule-signature"><a class="anchor" href="path.html">path</a> path.realpath</pre></p>
Returns the canonical path for this path by repeatedly replacing all symbolic links with their referents.