Skip to content

Commit 4219851

Browse files
committed
Resolve kotlin-stdlib.jar from snap install
1 parent 4969c58 commit 4219851

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ object BackupClassPathResolver : ClassPathResolver {
1818
fun findKotlinStdlib(): Path? =
1919
findLocalArtifact("org.jetbrains.kotlin", "kotlin-stdlib")
2020
?: findKotlinCliCompilerLibrary("kotlin-stdlib")
21+
?: findAlternativeLibraryLocation("kotlin-stdlib")
2122

2223
private fun findLocalArtifact(group: String, artifact: String) =
2324
tryResolving("$artifact using Maven") { tryFindingLocalArtifactUsing(group, artifact, findLocalArtifactDirUsingMaven(group, artifact)) }
@@ -70,6 +71,11 @@ private fun findKotlinCliCompilerLibrary(name: String): Path? =
7071
?.orElse(null)
7172

7273

74+
// alternative library locations like for snap
75+
// (can probably just use elvis operator and multiple similar expressions for other install directories)
76+
private fun findAlternativeLibraryLocation(name: String): Path? =
77+
Paths.get("/snap/kotlin/current/lib/${name}.jar").existsOrNull()
78+
7379
private fun Path.existsOrNull() =
7480
if (Files.exists(this)) this else null
7581

0 commit comments

Comments
 (0)