pathString

Returns the string representation of this path.

val Path.pathString: String(source)
import java.nio.file.Path
import kotlin.io.path.pathString

fun main() {
    val path: Path = Path.of("src", "main", "kotlin", "Example.kt")
    println(path.pathString)  // Output: src/main/kotlin/Example.kt
}

Source