Skip to content

Commit 4969c58

Browse files
authored
Merge pull request #383 from themkat/kotlinc_stdlib_location
Support different kotlin/kotlinc install directory setups in backup classpath resolver
2 parents 9402a44 + 0a9d0b8 commit 4969c58

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

shared/src/main/kotlin/org/javacs/kt/classpath/BackupClassPathResolver.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,16 @@ private fun findKotlinCliCompilerLibrary(name: String): Path? =
5353
findCommandOnPath("kotlinc")
5454
?.toRealPath()
5555
?.parent // bin
56-
?.parent // libexec
57-
?.resolve("lib")
56+
?.parent // libexec or "top-level" dir
57+
?.let {
58+
// either in libexec or a top-level directory (that may contain libexec, or just a lib-directory directly)
59+
val possibleLibDir = it.resolve("lib")
60+
if (Files.exists(possibleLibDir)) {
61+
possibleLibDir
62+
} else {
63+
it.resolve("libexec").resolve("lib")
64+
}
65+
}
5866
?.takeIf { Files.exists(it) }
5967
?.let(Files::list)
6068
?.filter { it.fileName.toString() == "$name.jar" }

0 commit comments

Comments
 (0)