IMPORTANT: The Bazel docs have moved! Please update your bookmark to https://bazel.build/rules/lib/path

You can read about the migration, and let us know what you think.

Extensions > API reference > path

path

A structure representing a file to be used inside a repository.

basename

string path.basename

A string giving the basename of the file.

dirname

path path.dirname

The parent directory of this file, or None if this file does not have a parent.

exists

bool path.exists

Returns true if the file denoted by this path exists.

get_child

path path.get_child(child_path)

Append the given path to this path and return the resulted path.

Parameters

Parameter Description
child_path required
The path to append to this path.

readdir

list path.readdir()

The list of entries in the directory denoted by this path.

realpath

path path.realpath

Returns the canonical path for this path by repeatedly replacing all symbolic links with their referents.