aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Generation/configurationImpl.kt
diff options
context:
space:
mode:
authorRobert Stoll <rstoll@tutteli.ch>2018-06-21 22:35:31 +0200
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2019-03-11 19:07:12 +0300
commit20bd82d30881f8b8439ea49baab923bc04ff1f2e (patch)
treebb4d9870d3c1f223192764a266e74baaecefa0e5 /core/src/main/kotlin/Generation/configurationImpl.kt
parent9a4f7fec6b1ad37ffdce653ec9edc0fc269cfe97 (diff)
downloaddokka-20bd82d30881f8b8439ea49baab923bc04ff1f2e.tar.gz
dokka-20bd82d30881f8b8439ea49baab923bc04ff1f2e.tar.bz2
dokka-20bd82d30881f8b8439ea49baab923bc04ff1f2e.zip
Use canonicalPath instead of absolutePath for srcLink
This way a user can define "./" instead of an absolute path to the root of the project dir (or a user can use ../ etc.). Thus: - use canonicalPath in: - SourceLinkDefinitionImpl::parseSourceLinkDefinition - and DocumentationNode.appendSourceLink => here because if the config is deserialized we bypass parseSourceLinkDefinition - also use canonicalPath for the path of PsiElement Moreover: - make sure the comparison works for unix and windows paths - fixes #289
Diffstat (limited to 'core/src/main/kotlin/Generation/configurationImpl.kt')
-rw-r--r--core/src/main/kotlin/Generation/configurationImpl.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Generation/configurationImpl.kt b/core/src/main/kotlin/Generation/configurationImpl.kt
index 90e27b4b..eecf122e 100644
--- a/core/src/main/kotlin/Generation/configurationImpl.kt
+++ b/core/src/main/kotlin/Generation/configurationImpl.kt
@@ -11,9 +11,9 @@ data class SourceLinkDefinitionImpl(override val path: String,
companion object {
fun parseSourceLinkDefinition(srcLink: String): SourceLinkDefinition {
val (path, urlAndLine) = srcLink.split('=')
- return SourceLinkDefinitionImpl(File(path).absolutePath,
+ return SourceLinkDefinitionImpl(File(path).canonicalPath,
urlAndLine.substringBefore("#"),
- urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#" + it })
+ urlAndLine.substringAfter("#", "").let { if (it.isEmpty()) null else "#$it" })
}
}
}