diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-26 07:11:18 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-26 07:11:18 -0700 |
commit | 41073f8db662906ada4b779f199ea6d5f4bd5e1f (patch) | |
tree | 0dbee4c8a3bb7e0835a51ea7d3358a411f227b24 /src/partest | |
parent | 970c245a3e96cb52167428bef80d7e772876bd12 (diff) | |
parent | 85272095b1a862cd0987f74354966cfc6fd2033b (diff) | |
download | scala-41073f8db662906ada4b779f199ea6d5f4bd5e1f.tar.gz scala-41073f8db662906ada4b779f199ea6d5f4bd5e1f.tar.bz2 scala-41073f8db662906ada4b779f199ea6d5f4bd5e1f.zip |
Merge pull request #2584 from som-snytt/issue/repl-tools-jar
SI-7410 REPL uses improved tools.jar locator
Diffstat (limited to 'src/partest')
-rw-r--r-- | src/partest/scala/tools/partest/nest/PathSettings.scala | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/src/partest/scala/tools/partest/nest/PathSettings.scala b/src/partest/scala/tools/partest/nest/PathSettings.scala index 8e454d8de8..030c515947 100644 --- a/src/partest/scala/tools/partest/nest/PathSettings.scala +++ b/src/partest/scala/tools/partest/nest/PathSettings.scala @@ -5,10 +5,8 @@ package scala.tools.partest package nest -import scala.tools.nsc.Properties.{ setProp, propOrEmpty, propOrNone, propOrElse } import scala.tools.nsc.util.ClassPath import scala.tools.nsc.io.{ Path, File, Directory } -import scala.util.Properties.{ envOrElse, envOrNone, javaHome, jdkHome } import Path._ object PathSettings { @@ -80,34 +78,9 @@ object PathSettings { lazy val diffUtils: File = findJar(buildPackLibDir.files, "diffutils") getOrElse sys.error(s"No diffutils.jar found in '$buildPackLibDir'.") - /** The platform-specific support jar. - * Usually this is tools.jar in the jdk/lib directory of the platform distribution. - * The file location is determined by probing the lib directory under JDK_HOME or JAVA_HOME, - * if one of those environment variables is set, then the lib directory under java.home, - * and finally the lib directory under the parent of java.home. Or, as a last resort, - * search deeply under those locations (except for the parent of java.home, on the notion - * that if this is not a canonical installation, then that search would have little - * chance of succeeding). + /** The platform-specific support jar, `tools.jar`. */ - lazy val platformTools: Option[File] = { - val jarName = "tools.jar" - def jarPath(path: Path) = (path / "lib" / jarName).toFile - def jarAt(path: Path) = { - val f = jarPath(path) - if (f.isFile) Some(f) else None - } - val jdkDir = { - val d = Directory(jdkHome) - if (d.isDirectory) Some(d) else None - } - def deeply(dir: Directory) = dir.deepFiles find (_.name == jarName) - - val home = envOrNone("JDK_HOME") orElse envOrNone("JAVA_HOME") map (p => Path(p)) - val install = Some(Path(javaHome)) - - (home flatMap jarAt) orElse (install flatMap jarAt) orElse (install map (_.parent) flatMap jarAt) orElse - (jdkDir flatMap deeply) - } + lazy val platformTools: Option[File] = PathResolver.SupplementalLocations.platformTools } class PathSettings() { |