JAL-3285 fix incorrect file paths on HMMAlign/Search results
[jalview.git] / src / jalview / hmmer / HmmerCommand.java
index 73995af..20e0083 100644 (file)
@@ -257,7 +257,8 @@ public abstract class HmmerCommand implements Runnable
    * @return
    * @throws IOException
    */
-  protected String getCommandPath(String cmd) throws IOException
+  protected String getCommandPath(String cmd)
+          throws IOException
   {
     String binariesFolder = Cache.getProperty(Preferences.HMMER_PATH);
     // ensure any symlink to the directory is resolved:
@@ -269,7 +270,7 @@ public abstract class HmmerCommand implements Runnable
               .formatMessage("label.executable_not_found", cmd));
     }
 
-    return file == null ? null : getFilePath(file);
+    return file == null ? null : getFilePath(file, true);
   }
 
   /**
@@ -323,12 +324,15 @@ public abstract class HmmerCommand implements Runnable
    * X with /cygdrive/x.
    * 
    * @param resultFile
+   * @param isInCygwin
+   *                     True if file is to be read/written from within the Cygwin
+   *                     shell. Should be false for any imports.
    * @return
    */
-  protected String getFilePath(File resultFile)
+  protected String getFilePath(File resultFile, boolean isInCygwin)
   {
     String path = resultFile.getAbsolutePath();
-    if (Platform.isWindows())
+    if (Platform.isWindows() && isInCygwin)
     {
       // the first backslash escapes '\' for the regular expression argument
       path = path.replaceAll("\\" + File.separator, "/");