summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/util/PathResolver.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-08-06 13:08:36 +0000
committerPaul Phillips <paulp@improving.org>2011-08-06 13:08:36 +0000
commit6d45fddd4c6537fb343e901d58491b81475e3786 (patch)
treebf6fd74702f2c47c4a31f9917d43d955506be9b3 /src/compiler/scala/tools/util/PathResolver.scala
parent8709b52eef9a0c0b2600664e38e01af3423e93f6 (diff)
downloadscala-6d45fddd4c6537fb343e901d58491b81475e3786.tar.gz
scala-6d45fddd4c6537fb343e901d58491b81475e3786.tar.bz2
scala-6d45fddd4c6537fb343e901d58491b81475e3786.zip
Attacked classpaths to get "." off of it when i...
Attacked classpaths to get "." off of it when it's not actually specified. The commit makes me nervous, but there's no invisible way to fix something like this. ** Attention, this commit changes classpath handling ** We desperately need some way of testing that the classpath has certain qualities and does not have others; partest is not that way. Closes SI-4857, no review.
Diffstat (limited to 'src/compiler/scala/tools/util/PathResolver.scala')
-rw-r--r--src/compiler/scala/tools/util/PathResolver.scala26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala
index 347e900886..3ea5aa1703 100644
--- a/src/compiler/scala/tools/util/PathResolver.scala
+++ b/src/compiler/scala/tools/util/PathResolver.scala
@@ -74,13 +74,7 @@ object PathResolver {
* to the path resolution specification.
*/
object Defaults {
- /* Against my better judgment, giving in to martin here and allowing
- * CLASSPATH as the default if no -cp is given. Only if there is no
- * command line option or environment variable is "." used.
- */
- def scalaUserClassPath = firstNonEmpty(Environment.classPathEnv, ".")
- def scalaSourcePath = Environment.sourcePathEnv
-
+ def scalaSourcePath = Environment.sourcePathEnv
def javaBootClassPath = Environment.javaBootClassPath
def javaUserClassPath = Environment.javaUserClassPath
def javaExtDirs = Environment.javaExtDirs
@@ -195,9 +189,25 @@ class PathResolver(settings: Settings, context: JavaContext) {
def javaUserClassPath = if (useJavaClassPath) Defaults.javaUserClassPath else ""
def scalaBootClassPath = cmdLineOrElse("bootclasspath", Defaults.scalaBootClassPath)
def scalaExtDirs = cmdLineOrElse("extdirs", Defaults.scalaExtDirs)
- def userClassPath = cmdLineOrElse("classpath", Defaults.scalaUserClassPath)
def sourcePath = cmdLineOrElse("sourcepath", Defaults.scalaSourcePath)
+ /** Against my better judgment, giving in to martin here and allowing
+ * CLASSPATH to be used automatically. So for the user-specified part
+ * of the classpath:
+ *
+ * - If -classpath or -cp is given, it is that
+ * - Otherwise, if CLASSPATH is set, it is that
+ * - If neither of those, then "." is used.
+ */
+ def userClassPath = (
+ if (!settings.classpath.isDefault)
+ settings.classpath.value
+ else sys.props("CLASSPATH") match {
+ case null => "."
+ case cp => cp
+ }
+ )
+
import context._
// Assemble the elements!