From a34d5672141d3aed35f0f6effb787d6524652a92 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Thu, 19 Jun 2014 10:42:05 +0200
Subject: [PATCH] now uses direct class file

---
 .../lumc/sasc/biopet/core/BiopetQCommandLine.scala | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala
index 19d9a39a2..336a547cb 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQCommandLine.scala
@@ -38,6 +38,7 @@ import org.broadinstitute.sting.utils.classloader.PluginManager
 import org.broadinstitute.sting.utils.exceptions.UserException
 import org.broadinstitute.sting.utils.io.IOUtils
 import org.broadinstitute.sting.utils.help.ApplicationDetails
+import java.io.FileOutputStream
 import java.net.URL
 import java.util.{ResourceBundle, Arrays}
 import org.broadinstitute.sting.utils.text.TextFormattingUtils
@@ -97,15 +98,20 @@ class BiopetQCommandLine extends CommandLineProgram with Logging {
   private var shuttingDown = false
 
   private lazy val qScriptPluginManager = {
-    //qScriptClasses = IOUtils.tempDir("Q-Classes-", "", settings.qSettings.tempDirectory)
+    qScriptClasses = IOUtils.tempDir("Q-Classes-", "", settings.qSettings.tempDirectory)
     //qScriptManager.loadScripts(scripts, qScriptClasses)
-    var temp: Seq[URL] = Seq()
+    //var temp: Seq[URL] = Seq()
     for (t <- scripts) {
-      temp :+= this.getClass.getResource(t.toString)
+      val is = getClass.getResourceAsStream(t.getAbsolutePath)
+      val os = new FileOutputStream(qScriptClasses.getAbsolutePath + "/" + t.getName)
+      org.apache.commons.io.IOUtils.copy(is, os)
+      os.close()
+      //temp :+= this.getClass.getResource(t.toString)
+      //logger.info(this.getClass.getResource(t.toString))
       val s = if (t.getName.endsWith("/")) t.getName.substring(0, t.getName.length - 1) else t.getName
       pipelineName = s + "." + System.currentTimeMillis
     }
-    new PluginManager[QScript](qPluginType, temp)
+    new PluginManager[QScript](qPluginType, List(qScriptClasses.toURI.toURL))
   }
 
   private lazy val qCommandPlugin = {
-- 
GitLab