def classpathForResources()

in cassandra-launcher/src/main/scala/org/apache/pekko/persistence/cassandra/testkit/CassandraLauncher.scala [168:185]


  def classpathForResources(resources: String*): immutable.Seq[String] = {
    resources
      .map { resource =>
        this.getClass.getClassLoader.getResource(resource) match {
          case null =>
            sys.error("Resource not found: " + resource)
          case fileUrl if fileUrl.getProtocol == "file" =>
            new File(URI.create(fileUrl.toString.stripSuffix(resource))).getCanonicalPath
          case jarUrl if jarUrl.getProtocol == "jar" =>
            new File(URI.create(jarUrl.getPath.takeWhile(_ != '!'))).getCanonicalPath
          case _ =>
            sys.error("Resource not supported: " + resource)
        }
      }
      .distinct
      .toList
      .filterNot(_.endsWith("assembly.jar")) // TODO required?
  }