From 3f2861f01d4157c8c9f778433defbe4d69be3d2e Mon Sep 17 00:00:00 2001
From: Philippe Suter <philippe.suter@gmail.com>
Date: Thu, 31 Mar 2011 00:41:34 +0000
Subject: [PATCH] support for manually set classpath

---
 src/funcheck/Main.scala | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/funcheck/Main.scala b/src/funcheck/Main.scala
index fe97d33a5..2796bcf85 100644
--- a/src/funcheck/Main.scala
+++ b/src/funcheck/Main.scala
@@ -10,7 +10,7 @@ object Main {
 
   def main(args : Array[String]) : Unit = run(args)
 
-  def runFromString(program : String, args : Array[String], reporter : Reporter = new DefaultReporter) : Unit = {
+  def runFromString(program : String, args : Array[String], reporter : Reporter = new DefaultReporter, classPath : Option[Seq[String]] = None) : Unit = {
     import java.io.{BufferedWriter,File,FileWriter,IOException}
 
     try {
@@ -19,14 +19,15 @@ object Main {
       val out = new BufferedWriter(new FileWriter(file))
       out.write(program)
       out.close
-      run(file.getPath.toString +: args, reporter)
+      run(file.getPath.toString +: args, reporter, classPath)
     } catch {
       case e : IOException => reporter.error(e.getMessage)
     }
   }
 
-  def run(args: Array[String], reporter: Reporter = new DefaultReporter) : Unit = {
+  def run(args: Array[String], reporter: Reporter = new DefaultReporter, classPath : Option[Seq[String]] = None) : Unit = {
     val settings = new Settings
+    classPath.foreach(s => settings.classpath.tryToSet(s.toList))
     runWithSettings(args, settings, s => reporter.info(s), Some(p => defaultAction(p, reporter)))
   }
 
-- 
GitLab