toRelativeString

Platform and version requirements: JVM (1.0)
fun File.toRelativeString(base: File): String

Calculates the relative path for this file from base file. Note that the base file is treated as a directory. If this file matches the base file, then an empty string will be returned.

Exceptions

IllegalArgumentException - if this and base paths have different roots.

Return relative path from base to this.

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/java.io.-file/to-relative-string.html