From 4b9180be94b1a09d4ed9bb65e15d29d8cc332a7d Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Fri, 3 Aug 2007 10:30:58 +0000
Subject: [PATCH] fix for creating running directory

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@6278 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 uk/ac/sanger/artemis/j2ssh/SshPSUClient.java | 48 +++++++++++---------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java b/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java
index f6129dcc5..c17e5bfe2 100644
--- a/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java
+++ b/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java
@@ -331,31 +331,35 @@ public class SshPSUClient extends Thread
       if(index > -1)
         filename = filename.substring(index+1);
 
-      try
-      {
-        if(!keep)
-          wdir = wdir+"/"+user;
-        sftp.mkdir(wdir);
-        wdir = wdir+"/"+program+"/";
-
-        sftp.mkdir(wdir);
-//      sftp.put(filepath, wdir+filename);
-      }
-      catch(SshException sshe)
+      if(i == 0)
       {
-        logger4j.debug("runBlastOrFasta()");
-        if(System.getProperty("debug") != null)
+        try
         {
-          sshe.printStackTrace();
+          if(!keep)
+            wdir = wdir + "/" + user;
+          sftp.mkdir(wdir);
+          wdir = wdir + "/" + program + "/";
+
+          sftp.mkdir(wdir);
+          logger4j.debug("mkdir() " + wdir);
+          // sftp.put(filepath, wdir+filename);
+        }
+        catch(SshException sshe)
+        {
+          logger4j.debug("runBlastOrFasta()");
+          if(System.getProperty("debug") != null)
+          {
+            sshe.printStackTrace();
+          }
+          rescue();
+          sftp = getSftpClient();
+          if(!wdir.endsWith(program + "/"))
+            wdir = wdir + "/" + program + "/";
+        }
+        catch(IOException ioe)
+        {
+          // directory already created
         }
-        rescue();
-        sftp = getSftpClient();
-        if(!wdir.endsWith(program+"/"))
-          wdir = wdir+"/"+program+"/";
-      }
-      catch(IOException ioe)
-      {
-        // directory already created
       }
  
 
-- 
GitLab