Rewrote my own submitted code of a year ago from trac and added
scalawhich to the tools dir. Closes #657. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@20889 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
30c3d186e5
commit
91abb5601b
|
@ -0,0 +1,39 @@
|
|||
/* NSC -- new Scala compiler
|
||||
* Copyright 2005-2010 LAMP/EPFL
|
||||
* @author Paul Phillips
|
||||
*/
|
||||
|
||||
package scala.tools
|
||||
package util
|
||||
|
||||
import scala.tools.nsc._
|
||||
|
||||
/** A tool for identifying which classfile is being used.
|
||||
* under the given conditions.
|
||||
*/
|
||||
object Which
|
||||
{
|
||||
def main(args: Array[String]): Unit = {
|
||||
val settings = new Settings()
|
||||
val names = settings.processArguments(args.toList, true)._2
|
||||
val global = new Global(settings)
|
||||
val cp = global.classPath
|
||||
|
||||
import cp._
|
||||
|
||||
for (name <- names) {
|
||||
def fail = println("Could not find: %s".format(name))
|
||||
(cp findClass name) match {
|
||||
case Some(classRep) => classRep.binary match {
|
||||
case Some(f) => println("%s is %s".format(name, f))
|
||||
case _ => fail
|
||||
}
|
||||
case _ => fail
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
|
||||
scala scala.tools.util.Which $*
|
Loading…
Reference in New Issue