Skip to content
Snippets Groups Projects
Commit 3f2861f0 authored by Philippe Suter's avatar Philippe Suter
Browse files

support for manually set classpath

parent d551188a
Branches
Tags
No related merge requests found
...@@ -10,7 +10,7 @@ object Main { ...@@ -10,7 +10,7 @@ object Main {
def main(args : Array[String]) : Unit = run(args) 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} import java.io.{BufferedWriter,File,FileWriter,IOException}
try { try {
...@@ -19,14 +19,15 @@ object Main { ...@@ -19,14 +19,15 @@ object Main {
val out = new BufferedWriter(new FileWriter(file)) val out = new BufferedWriter(new FileWriter(file))
out.write(program) out.write(program)
out.close out.close
run(file.getPath.toString +: args, reporter) run(file.getPath.toString +: args, reporter, classPath)
} catch { } catch {
case e : IOException => reporter.error(e.getMessage) 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 val settings = new Settings
classPath.foreach(s => settings.classpath.tryToSet(s.toList))
runWithSettings(args, settings, s => reporter.info(s), Some(p => defaultAction(p, reporter))) runWithSettings(args, settings, s => reporter.info(s), Some(p => defaultAction(p, reporter)))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment