summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McDirmid <sean.mcdirmid@gmail.com>2006-02-23 14:38:55 +0000
committerSean McDirmid <sean.mcdirmid@gmail.com>2006-02-23 14:38:55 +0000
commit806b26a007522cec6d96e4ee8b6403e8c9c87a20 (patch)
tree63f31f6b7e93eae67477ac95d92e3b8bec8077ac
parent25ed8431be1bd5157fb27463d2e6e7b5076378ef (diff)
downloadscala-806b26a007522cec6d96e4ee8b6403e8c9c87a20.tar.gz
scala-806b26a007522cec6d96e4ee8b6403e8c9c87a20.tar.bz2
scala-806b26a007522cec6d96e4ee8b6403e8c9c87a20.zip
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 1299737036..92b00aae65 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -22,6 +22,8 @@ import java.util.StringTokenizer;
* @author Sean McDirmid
*/
class ClassPath(onlyPresentation : Boolean) {
+ def this() = this(false);
+
class Source(val location : AbstractFile, val compile : Boolean) {
// assert(location != null, "cannot find source location");
@@ -148,6 +150,16 @@ class ClassPath(onlyPresentation : Boolean) {
def root = new Context(entries.toList);
+ def lookupPath(path : String, isDir : Boolean) = {
+ val txt = root.find(path, isDir);
+ if (txt.entries.isEmpty) null;
+ else txt.entries.head.location;
+ }
+
+ def this(classpath : String) = {
+ this();
+ addFilesInPath(classpath);
+ }
def this(classpath : String, source : String, output : String, boot : String, extdirs : String) = {
this();
@@ -162,14 +174,13 @@ class ClassPath(onlyPresentation : Boolean) {
val strtok = new StringTokenizer(source, File.pathSeparator);
if (!strtok.hasMoreTokens()) {
- val output0 = (new Output(clazzes, null));
- entries += output0;
+ val output0 = (new Output(clazzes, null));
+ entries += output0;
} else while (strtok.hasMoreTokens()) {
- val sources = AbstractFile.getDirectory(strtok.nextToken());
-
- val output0 = (new Output(clazzes, sources));
- //System.err.println("OUTPUT: " + output);
- entries += output0;
+ val sources = AbstractFile.getDirectory(strtok.nextToken());
+ val output0 = (new Output(clazzes, sources));
+ //System.err.println("OUTPUT: " + output);
+ entries += output0;
}
addFilesInPath(classpath);
//System.err.println("CLASSPATH: " + root);