diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-14 08:47:18 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-14 08:47:18 +0000 |
commit | 1ec5bf5c82ab29a565eeeec2ce8df2bddab7da0b (patch) | |
tree | 0b5b3935db11cf7d9bacecbe267e3d29dbf180a8 /src/compiler/scala/tools/nsc/util/ClassPath.scala | |
parent | d7ad3f348753884e154ab40aa848b6f9d85d7b52 (diff) | |
download | scala-1ec5bf5c82ab29a565eeeec2ce8df2bddab7da0b.tar.gz scala-1ec5bf5c82ab29a565eeeec2ce8df2bddab7da0b.tar.bz2 scala-1ec5bf5c82ab29a565eeeec2ce8df2bddab7da0b.zip |
More classpath work, and cleanups in the vicini...
More classpath work, and cleanups in the vicinities of everything
manipulating classpaths. Review by anyone willing to slog through the
approximately dozen different ways the classpath can be influenced.
Diffstat (limited to 'src/compiler/scala/tools/nsc/util/ClassPath.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/ClassPath.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index 25b5b83a23..013cd89a44 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -15,6 +15,7 @@ import scala.collection.mutable.{ListBuffer, ArrayBuffer, HashSet => MutHashSet} import io.{ File, Directory, Path, AbstractFile } import scala.tools.util.StringOps.splitWhere import Path.isJarOrZip +import scala.tools.util.PathResolver import File.pathSeparator /** <p> @@ -47,7 +48,7 @@ object ClassPath { } /** Split classpath using platform-dependent path separator */ - def split(path: String): List[String] = path split pathSeparator filterNot (_ == "") toList + def split(path: String): List[String] = (path split pathSeparator).toList filterNot (_ == "") distinct /** Join classpath using platform-dependent path separator */ def join(path: Seq[String]): String = path filterNot (_ == "") mkString pathSeparator @@ -55,6 +56,9 @@ object ClassPath { /** Split the classpath, apply a transformation function, and reassemble it. */ def map(cp: String, f: String => String): String = join(split(cp) map f) + /** Split the classpath and map them into urls */ + def toURLs(cp: String): List[URL] = split(cp) map (x => Path(x).toAbsolute.toURL) + /** Expand path and possibly expanding stars */ def expandPath(path: String, expandStar: Boolean = true): List[String] = if (expandStar) split(path) flatMap expandS |