Skip to content

Commit

Permalink
Fix minor initialization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-siegel committed Oct 8, 2021
1 parent 5ece066 commit 34c174c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/core/src/main/scala/org/cgsuite/lang/CgscriptClasspath.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.cgsuite.lang

import java.nio.file.FileSystemAlreadyExistsException
import java.nio.file.spi.FileSystemProvider
import java.util.Collections

Expand Down Expand Up @@ -44,8 +45,12 @@ object CgscriptClasspath {
// Search in the production jar.
val uri = getClass.getResource("resources").toURI
if (uri.getScheme == "jar") {
FileSystemProvider.installedProviders.asScala find { _.getScheme equalsIgnoreCase "jar" } foreach { provider =>
provider.newFileSystem(uri, Collections.emptyMap[String, AnyRef])
try {
FileSystemProvider.installedProviders.asScala find { _.getScheme equalsIgnoreCase "jar" } foreach { provider =>
provider.newFileSystem(uri, Collections.emptyMap[String, AnyRef])
}
} catch {
case _: FileSystemAlreadyExistsException =>
}
}
File(getClass.getResource("resources").toURI)
Expand Down Expand Up @@ -85,8 +90,12 @@ object CgscriptClasspath {
def copyExamples(dest: File): Unit = {
val uri = getClass.getResource("examples").toURI
if (uri.getScheme == "jar") {
FileSystemProvider.installedProviders.asScala find { _.getScheme equalsIgnoreCase "jar" } foreach { provider =>
provider.newFileSystem(uri, Collections.emptyMap[String, AnyRef])
try {
FileSystemProvider.installedProviders.asScala find { _.getScheme equalsIgnoreCase "jar" } foreach { provider =>
provider.newFileSystem(uri, Collections.emptyMap[String, AnyRef])
}
} catch {
case _: FileSystemAlreadyExistsException =>
}
}
val examplesDir = File(getClass.getResource("examples").toURI)
Expand Down

0 comments on commit 34c174c

Please sign in to comment.