From: Ben Soares Date: Thu, 9 May 2019 16:03:12 +0000 (+0100) Subject: JAL-3247 JAL-3254 Fixed file association launch behaviour in getdown in Windows X-Git-Tag: Release_2_11_0~12^2^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0bbf6c2ef8c0f28d909aa7921f9ea08d16954de6;p=jalview.git JAL-3247 JAL-3254 Fixed file association launch behaviour in getdown in Windows --- diff --git a/build.gradle b/build.gradle index d81604e..2e51f15 100644 --- a/build.gradle +++ b/build.gradle @@ -800,6 +800,9 @@ install4j { } installDir = file(install4jHomeDir) mediaTypes = Arrays.asList(install4jMediaTypes.split(",")) + if (dev.equals("true")) { + faster = true + } } def install4jConf @@ -829,7 +832,9 @@ task copyInstall4jTemplate(type: Copy) { 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz, 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir, 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz, - 'INSTALL4JINFOPLISTFILEASSOCIATIONS': install4jInfoPlistFileAssociations + 'INSTALL4JINFOPLISTFILEASSOCIATIONS': install4jInfoPlistFileAssociations, + 'COPYRIGHT_MESSAGE': install4jCopyrightMessage, + 'MACOS_BUNDLE_ID': install4jMacOSBundleId ] ) if (OSX_KEYPASS=="") { diff --git a/getdown/lib/getdown-launcher.jar b/getdown/lib/getdown-launcher.jar index 1f38352..b25920e 100644 Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java index 4d75236..7376cdb 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java @@ -1792,15 +1792,19 @@ public class Application public void newAppbase (URL url) { if ( - url.getHost().endsWith(".jalview.org") - || url.equals("jalview.org") - || (url.getProtocol().equals("file") && url.getHost().equals("")) + url.getHost().equals(locatorDomain) + || (allowLocatorSubdomains && url.getHost().endsWith("."+locatorDomain)) + || (allowLocatorFileProtocol && url.getProtocol().equals("file") && url.getHost().equals("")) ) { newAppbase = url; log.info("Appbase set to Java Version Locator url '"+url.toString()+"'"); return; } - log.info("Java Version Locator url '"+url.toString()+"' does not have a jalview.org domain. Ignoring"); + log.info("Java Version Locator url '"+url.toString()+"' does not have satisfy domain rules (" + +(allowLocatorFileProtocol?"file:///|":"") + +"https://" + +(allowLocatorSubdomains?"[*.]":locatorDomain) + +"). Ignoring"); } protected final EnvConfig _envc; @@ -1868,6 +1872,9 @@ public class Application protected static final String ENV_VAR_PREFIX = "%ENV."; protected static final Pattern ENV_VAR_PATTERN = Pattern.compile("%ENV\\.(.*?)%"); + protected static final String locatorDomain = "jalview.org"; + protected boolean allowLocatorSubdomains = true; + protected boolean allowLocatorFileProtocol = true; public static final String locatorFileExtension = "jvl"; } diff --git a/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java b/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java index f87382a..33f97e8 100644 --- a/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java +++ b/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java @@ -1043,7 +1043,7 @@ public abstract class Getdown extends Thread if (p != null && p.length() > 0) { String[] filenames; if (p.startsWith(q) && p.endsWith(q)) { - filenames = p.substring(1,p.length()-1).split("\" \""); + filenames = p.substring(q.length(),p.length()-q.length()).split(q+" "+q); } else { filenames = new String[]{p}; } @@ -1056,7 +1056,6 @@ public abstract class Getdown extends Thread } // jvl files if (_app.locatorFileExtension.equals(ext.toLowerCase())) { - // Do something special with this here File f = new File(filename); if (f.exists()) { String appbase = null; diff --git a/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java b/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java index 42dca17..a907cef 100644 --- a/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java +++ b/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java @@ -29,6 +29,7 @@ import javax.swing.WindowConstants; import com.install4j.api.launcher.StartupNotification; import com.samskivert.swing.util.SwingUtil; +import com.threerings.getdown.data.Application; import com.threerings.getdown.data.EnvConfig; import com.threerings.getdown.data.SysProps; import com.threerings.getdown.util.LaunchUtil; @@ -97,7 +98,8 @@ public class GetdownApp new StartupNotification.Listener() { @Override public void startupPerformed(String parameters) - { + { + log.warning("startupPerformed: '"+parameters+"'"); setStartupFilesParameterString(parameters); } }); @@ -267,8 +269,33 @@ public class GetdownApp protected JFrame _frame; }; - if (getStartupFilesParameterString() != null) { + /* + log.warning("Startup file?", + "paramstring", '"'+getStartupFilesParameterString()+'"', + "isWindows", LaunchUtil.isWindows(), + "argv.length", argv.length, + "argv[0]", argv.length>0?argv[0]:"NULL", + "argv[1]", argv.length>1?argv[1]:"NULL", + "argv[2]", argv.length>2?argv[2]:"NULL", + "argv[3]", argv.length>3?argv[3]:"NULL" + ); + */ + if (getStartupFilesParameterString() != null && getStartupFilesParameterString().length() > 0) { app.setStartupFilesFromParameterString(getStartupFilesParameterString()); + } else if ( + getStartupFilesParameterString().length() == 0 + && LaunchUtil.isWindows() + && argv.length >= 3 + && argv[0].equals(".") + && argv[1].equals("noappid") + && argv[2].endsWith("."+Application.locatorFileExtension) + ) { + log.info("Jalview Version Locator in args: "+argv[2]); + app.setStartupFilesFromParameterString(argv[2]); + String[] newArgv = new String[argv.length - 1]; + System.arraycopy(argv, 0, newArgv, 0, 2); + System.arraycopy(argv, 3, newArgv, 2, argv.length - 3); + argv = newArgv; } app.start(); return app; diff --git a/gradle.properties b/gradle.properties index 49ace5f..0bc3280 100644 --- a/gradle.properties +++ b/gradle.properties @@ -94,6 +94,8 @@ j11libDir = j11lib j11modDir = j11mod j11modules = com.sun.istack.runtime,com.sun.xml.bind,com.sun.xml.fastinfoset,com.sun.xml.streambuffer,com.sun.xml.txw2,com.sun.xml.ws.policy,java.activation,java.annotation,java.base,java.compiler,java.datatransfer,java.desktop,java.logging,java.management,java.management.rmi,java.naming,java.prefs,java.rmi,java.scripting,java.security.sasl,java.sql,java.xml,java.xml.bind,java.xml.soap,java.xml.ws,javax.jws,jdk.httpserver,jdk.jsobject,jdk.unsupported,jdk.xml.dom,org.jvnet.mimepull,org.jvnet.staxex,javax.servlet.api,java.ws.rs +install4jCopyrightMessage = ... +install4jMacOSBundleId = org.jalview.jalview-desktop install4jResourceDir = utils/install4j install4jTemplate = install4j_template.install4j install4jInfoPlistFileAssociations = file_associations_auto-Info_plist.xml @@ -105,3 +107,6 @@ OSX_KEYPASS = JSIGN_SH = echo eclipse_extra_jdt_prefs_file = .settings/org.eclipse.jdt.core.jalview.prefs + +dev = false + diff --git a/utils/install4j/install4j_template.install4j b/utils/install4j/install4j_template.install4j index 1b34aa5..3825190 100644 --- a/utils/install4j/install4j_template.install4j +++ b/utils/install4j/install4j_template.install4j @@ -83,9 +83,9 @@ - + - + @@ -116,9 +116,9 @@ - + - + @@ -150,7 +150,7 @@ - + @@ -232,9 +232,6 @@ false - - install4j - @@ -580,6 +577,9 @@ return console.askOkCancel(message, true); true + + true + @@ -710,6 +710,11 @@ return console.askOkCancel(message, true); ${compiler:sys.shortName} + + + ${compiler:sys.shortName} + + ${compiler:sys.fullName} @@ -720,7 +725,7 @@ return console.askOkCancel(message, true); - ../../resources/images/JalviewLogo_Huge.png + ../../resources/images/jalview_logos.ico @@ -747,10 +752,10 @@ return console.askOkCancel(message, true); - EXTENSIONS_REPLACED_BY_GRADLE + This action, identified by its name "EXTENSIONS_REPLACED_BY_GRADLE", will be replaced by gradle with the contents of file 'file_associations_auto_install4j.xml'. - EXTENSION + extensions_to_be_replaced_by_gradle @@ -817,7 +822,7 @@ return console.askOkCancel(message, true); - + @@ -926,7 +931,7 @@ return console.askOkCancel(message, true); - + @@ -1010,12 +1015,24 @@ return console.askYesNo(message, true); + + + + + + 95 + + + + + + - + jre @@ -1071,6 +1088,36 @@ return console.askYesNo(message, true); *.txt + + + *_new + + + + + digest.txt + + + + + digest2.txt + + + + + getdown-launcher.jarv + + + + + launcher.log + + + + + proxy.txt + + @@ -1081,7 +1128,7 @@ return console.askYesNo(message, true); - + @@ -1218,9 +1265,6 @@ return console.askYesNo(message, true); false - - install4j -