Skip to content
Snippets Groups Projects
Commit 8dd71b25 authored by Emmanouil (Manos) Koukoutos's avatar Emmanouil (Manos) Koukoutos Committed by Manos Koukoutos
Browse files

Make finding library in Eclipse more robust

parent 8291f8f7
No related branches found
No related tags found
No related merge requests found
...@@ -23,17 +23,18 @@ object ExtractionPhase extends LeonPhase[List[String], Program] { ...@@ -23,17 +23,18 @@ object ExtractionPhase extends LeonPhase[List[String], Program] {
val settings = new NSCSettings val settings = new NSCSettings
val scalaLib = Option( val scalaLib = Option(scala.Predef.getClass.getProtectionDomain.getCodeSource()).map{
scala.Predef.getClass.getProtectionDomain.getCodeSource() _.getLocation.getPath
) map { _.getLocation.getPath } getOrElse { }.orElse( for {
// We are in Eclipse. Look in Eclipse plugins to find scala lib // We are in Eclipse. Look in Eclipse plugins to find scala lib
val eclipsePlugins = System.getenv("ECLIPSE_HOME") + "/plugins" eclipseHome <- Option(System.getenv("ECLIPSE_HOME"))
new File(eclipsePlugins).listFiles().map{ _.getAbsolutePath }.find{ _ contains "scala-library"}. pluginsHome = eclipseHome + "/plugins"
getOrElse(ctx.reporter.fatalError("No Scala library found. " + plugins <- scala.util.Try(new File(pluginsHome).listFiles().map{ _.getAbsolutePath }).toOption
"If you are working in Eclipse, make sure to set the ECLIPSE_HOME environment variable." path <- plugins.find{ _ contains "scala-library"}
) } yield path).getOrElse( ctx.reporter.fatalError(
) "No Scala library found. If you are working in Eclipse, " +
} "make sure to set the ECLIPSE_HOME environment variable to your Eclipse installation home directory"
))
settings.classpath.value = scalaLib settings.classpath.value = scalaLib
settings.usejavacp.value = false settings.usejavacp.value = false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment