Extensions for java.nio.file.Path


fun Path.combineSafe(relativePath: Path): File

Append a relativePath safely that means that adding any extra .. path elements will not let access anything out of the reference directory (unless you have symbolic or hard links or multiple mount points)


val Path.extension: String

Finds an extension of the given Path


fun Path.normalizeAndRelativize(): Path

Remove all redundant . and .. path elements. Leading .. are also considered redundant.