blob: 206dccd67075d50338fc8ca46f57f4e594ccd7a7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package dotty.tools.dotc.repl
import java.net.JarURLConnection
import scala.collection.JavaConversions._
object ManifestInfo {
val attributes: Map[String, String] = {
for {
resourceUrl <- Option(getClass.getResource(getClass.getSimpleName + ".class"))
urlConnection = resourceUrl.openConnection() if urlConnection.isInstanceOf[JarURLConnection]
manifest <- Option(urlConnection.asInstanceOf[JarURLConnection].getManifest)
} yield {
manifest.getMainAttributes.foldLeft(Map[String, String]())(
(map, attribute) => map + (attribute._1.toString -> attribute._2.toString)
)
}
}.getOrElse(Map())
}
|