Merge branch 'Jalview-JS/bug/JAL-3762_URLparamsOverrideInfoArg' into develop
authorJim Procter <j.procter@dundee.ac.uk>
Wed, 15 Sep 2021 16:06:02 +0000 (17:06 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Wed, 15 Sep 2021 16:06:02 +0000 (17:06 +0100)
1  2 
src/jalview/util/Platform.java

@@@ -52,7 -52,7 +52,7 @@@ public class Platfor
            false;
  
    private static Boolean isNoJSMac = null, isNoJSWin = null, isMac = null,
 -          isWin = null;
 +          isWin = null, isLinux = null;
  
    private static Boolean isHeadless = null;
  
    }
  
    /**
 +   * added to check LaF for Linux
 +   * 
 +   * @return
 +   */
 +  public static boolean isLinux()
 +  {
 +    return (isLinux == null
 +            ? (isLinux = (System.getProperty("os.name").indexOf("Linux") >= 0))
 +            : isLinux);
 +  }
 +
 +  /**
     * 
     * @return true if HTML5 JavaScript
     */
  
    public static byte[] getFileBytes(File f)
    {
 -    return /** @j2sNative f && swingjs.JSUtil.getFileBytes$java_io_File(f) || */
 +    return /** @j2sNative f && swingjs.JSUtil.getFileAsBytes$O(f) || */
      null;
    }
  
  
    public static void getURLCommandArguments()
    {
-     /**
-      * Retrieve the first query field as command arguments to Jalview. Include
-      * only if prior to "?j2s" or "&j2s" or "#". Assign the applet's __Info.args
-      * element to this value.
-      * 
-      * @j2sNative var a =
-      *            decodeURI((document.location.href.replace("&","?").split("?j2s")[0]
-      *            + "?").split("?")[1].split("#")[0]); a &&
-      *            (J2S.thisApplet.__Info.args = a.split(" "));
-      */
+       try {
+       /**
+        * Retrieve the first query field as command arguments to Jalview. Include
+        * only if prior to "?j2s" or "&j2s" or "#". Assign the applet's
+        * __Info.args element to this value.
+        * 
+        * @j2sNative var a =
+        *            decodeURI((document.location.href.replace("&","?").split("?j2s")[0]
+        *            + "?").split("?")[1].split("#")[0]); a && (System.out.println("URL arguments detected were "+a)) &&
+        *            (J2S.thisApplet.__Info.urlargs = a.split(" ")); 
+        *            (!J2S.thisApplet.__Info.args || J2S.thisApplet.__Info.args == "" || J2S.thisApplet.__Info.args == "??") && (J2S.thisApplet.__Info.args = a) && (System.out.println("URL arguments were passed to J2S main."));
+        */
+     } catch (Throwable t)
+     {
+     }
    }
  
    /**