# Path

open class Path : Comparable<Path> (source)

Represents a path in Gradle.

## Properties

ROOT
Link copied to clipboard
val ROOT: Path
SEPARATOR
Link copied to clipboard
val SEPARATOR: String = ":"

## Functions

absolutePath
Link copied to clipboard
open fun absolutePath(path: String): String
Resolves the given name relative to this path.
open fun absolutePath(path: Path): Path
ancestors
Link copied to clipboard
@Incubating
open fun ancestors(): Iterable<Path>
Iterate over all ancestors of this path, starting with the root path (if absolute) or the first segment (if relative) and not including this path.
append
Link copied to clipboard
open fun append(path: Path): Path
Appends the supplied path to this path, returning the new path.
asString
Link copied to clipboard
open fun asString(): String
Returns the full path as a string.
child
Link copied to clipboard
open fun child(name: String): Path
Creates a child of this path with the given name.
compareTo
Link copied to clipboard
open fun compareTo(other: Path): Int
equals
Link copied to clipboard
open fun equals(@Nullable o: @Nullable Any): Boolean
getName
Link copied to clipboard
@Nullable
open fun getName(): @Nullable String
Returns the base name of this path, or null if this path is the root path.
getParent
Link copied to clipboard
@Nullable
open fun getParent(): @Nullable Path
Returns the parent of this path, or null if this path has no parent.
getPath
Link copied to clipboard
open fun getPath(): String
Returns string representation of this path.
hashCode
Link copied to clipboard
open fun hashCode(): Int
isAbsolute
Link copied to clipboard
open fun isAbsolute(): Boolean
path
Link copied to clipboard
open fun path(@Nullable path: @Nullable String): Path
relativePath
Link copied to clipboard
open fun relativePath(path: String): String
Calculates a path relative to this path.
open fun relativePath(path: Path): Path
removeFirstSegments
Link copied to clipboard
open fun removeFirstSegments(n: Int): Path
segment
Link copied to clipboard
open fun segment(index: Int): String
segmentCount
Link copied to clipboard
open fun segmentCount(): Int
segments
Link copied to clipboard
@Incubating
open fun segments(): List<String>
returns an immutable list of the segments of this path
startsWith
Link copied to clipboard
@Incubating
open fun startsWith(other: Path): Boolean
Determines if this path starts with the given path.
takeFirstSegments
Link copied to clipboard
@Incubating
open fun takeFirstSegments(n: Int): Path
Returns a `Path` containing only the first `n` segments of this `Path`.
toString
Link copied to clipboard
open fun toString(): String
validatePath
Link copied to clipboard
@Incubating
open fun validatePath(@Nullable path: @Nullable String)
throws if no path is specified