JAL-2422 JAL-3551 viewer text/variables generalised, Pymol paths added
[jalview.git] / src / jalview / ext / pymol / PymolManager.java
index f410b54..e3b913b 100644 (file)
@@ -43,20 +43,34 @@ public class PymolManager
    */
   public static List<String> getPymolPaths()
   {
+    return getPymolPaths(System.getProperty("os.name"));
+  }
+
+  /**
+   * Returns a list of paths to try for the PyMOL executable. Any user
+   * preference is placed first, otherwise 'standard' paths depending on the
+   * operating system.
+   * 
+   * @param os
+   *          operating system as reported by environment variable
+   *          {@code os.name}
+   * @return
+   */
+  protected static List<String> getPymolPaths(String os)
+  {
     List<String> pathList = new ArrayList<>();
   
     String userPath = Cache
             .getDefault(Preferences.PYMOL_PATH, null);
     if (userPath != null)
     {
-      pathList.add(0, userPath);
+      pathList.add(userPath);
     }
   
     /*
      * add default installation paths
      */
     String pymol = "PyMOL";
-    String os = System.getProperty("os.name");
     if (os.startsWith("Linux"))
     {
       pathList.add("/usr/local/pymol/bin/" + pymol);