diff options
Diffstat (limited to 'src/Utilities/Path.kt')
-rw-r--r-- | src/Utilities/Path.kt | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Utilities/Path.kt b/src/Utilities/Path.kt index fea22250..36277d9f 100644 --- a/src/Utilities/Path.kt +++ b/src/Utilities/Path.kt @@ -1,18 +1,19 @@ package org.jetbrains.dokka -import java.io.* +import java.io.File +import java.io.IOException fun File.getRelativePath(name: File): File { val parent = parentFile ?: throw IOException("No common directory") - val basePath = getCanonicalPath() + File.separator; - val targetPath = name.getCanonicalPath(); + val basePath = canonicalPath + File.separator; + val targetPath = name.canonicalPath; if (targetPath.startsWith(basePath)) { - return File(targetPath.substring(basePath.length())) + return File(targetPath.substring(basePath.length)) } else { return File(".." + File.separator + parent.getRelativePath(name)) } } -fun File.appendExtension(extension: String) = if (extension.isEmpty()) this else File(getPath() + "." + extension) +fun File.appendExtension(extension: String) = if (extension.isEmpty()) this else File(path + "." + extension) |