Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ object BackupClassPathResolver : ClassPathResolver {
fun findKotlinStdlib(): Path? =
findLocalArtifact("org.jetbrains.kotlin", "kotlin-stdlib")
?: findKotlinCliCompilerLibrary("kotlin-stdlib")
?: findAlternativeLibraryLocation("kotlin-stdlib")

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


// alternative library locations like for snap
// (can probably just use elvis operator and multiple similar expressions for other install directories)
private fun findAlternativeLibraryLocation(name: String): Path? =
Paths.get("/snap/kotlin/current/lib/${name}.jar").existsOrNull()

private fun Path.existsOrNull() =
if (Files.exists(this)) this else null

Expand Down