Skip to content

Commit

Permalink
Merge pull request #500 from kennethshackleton/simplify-load-embedded…
Browse files Browse the repository at this point in the history
…-notnull

Simplify mapping not null resource when loading embedded library.
  • Loading branch information
kennethshackleton authored Feb 4, 2024
2 parents 68619e6 + 2007081 commit 43b9628
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ internal fun libraryResourceNames(

@Throws(IOException::class)
fun loadEmbeddedLibrary(loader: ClassLoader, parentDirectory: String, name: String) {
val url = checkNotNull(libraryResourceNames(parentDirectory, name).mapNotNull {
val url = checkNotNull(libraryResourceNames(parentDirectory, name).firstNotNullOfOrNull {
loader.getResource(it)
}.firstOrNull()) { "Failed to find resource with name: $name" }
}) { "Failed to find resource with name: $name" }
@Suppress("NewApi") // Not used by Android.
val file = createTempFile("lib$name", "lib").toFile().apply { deleteOnExit() }
try {
Expand Down

0 comments on commit 43b9628

Please sign in to comment.