JAL-3247 JAL-3254 Fixed file association launch behaviour in getdown in Windows
authorBen Soares <bsoares@dundee.ac.uk>
Thu, 9 May 2019 16:03:12 +0000 (17:03 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Thu, 9 May 2019 16:03:12 +0000 (17:03 +0100)
build.gradle
getdown/lib/getdown-launcher.jar
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/Getdown.java
getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java
gradle.properties
utils/install4j/install4j_template.install4j

index d81604e..2e51f15 100644 (file)
@@ -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=="") {
index 1f38352..b25920e 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index 4d75236..7376cdb 100644 (file)
@@ -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";
 }
index f87382a..33f97e8 100644 (file)
@@ -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;
index 42dca17..a907cef 100644 (file)
@@ -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;
index 49ace5f..0bc3280 100644 (file)
@@ -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
+
index 1b34aa5..3825190 100644 (file)
@@ -83,9 +83,9 @@
     </components>
   </files>
   <launchers>
-    <launcher name="Offline Jalview Launcher" id="737" customizedId="" external="false" excludeFromMenu="false" unixMode="755" unixAutoStart="true" menuName="${compiler:sys.shortName}" icnsFile="../../resources/images/jalview_logos.icns" customMacBundleIdentifier="false" macBundleIdentifier="" swtApp="false" fileset="734" macBundleBinary="JavaApplicationStub" addMacEntitlements="false" macEntitlementsFile="" useCustomMacosExecutableName="true" customMacosExecutableName="${compiler:sys.shortName}" useJavaMinVersionOverride="false" javaMinVersionOverride="" useJavaMaxVersionOverride="false" javaMaxVersionOverride="" checkUpdater="false" updateExecutionMode="unattendedProgress" unattendedUpdateTitle="${i18n:updater.WindowTitle(&quot;${compiler:sys.fullName}&quot;)}">
+    <launcher name="Offline Jalview Launcher" id="737" customizedId="" external="false" excludeFromMenu="false" unixMode="755" unixAutoStart="true" menuName="${compiler:sys.shortName}" icnsFile="../../resources/images/jalview_logos.icns" customMacBundleIdentifier="true" macBundleIdentifier="$$MACOS_BUNDLE_ID$$" swtApp="false" fileset="734" macBundleBinary="JavaApplicationStub" addMacEntitlements="false" macEntitlementsFile="" useCustomMacosExecutableName="true" customMacosExecutableName="${compiler:sys.shortName}" useJavaMinVersionOverride="false" javaMinVersionOverride="" useJavaMaxVersionOverride="false" javaMaxVersionOverride="" checkUpdater="false" updateExecutionMode="unattendedProgress" unattendedUpdateTitle="${i18n:updater.WindowTitle(&quot;${compiler:sys.fullName}&quot;)}">
       <executable name="${compiler:sys.shortName}" type="1" iconSet="true" iconFile="../../resources/images/jalview_logos.ico" executableDir="." redirectStderr="true" stderrFile="error.log" stderrMode="overwrite" redirectStdout="true" stdoutFile="output.log" stdoutMode="overwrite" failOnStderrOutput="true" executableMode="1" changeWorkingDirectory="true" workingDirectory="." singleInstance="true" serviceStartType="2" serviceDependencies="" serviceDescription="" jreLocation="" executionLevel="asInvoker" checkConsoleParameter="true" globalSingleInstance="false" singleInstanceActivate="true" dpiAware="java9+">
-        <versionInfo include="true" fileVersion="" fileDescription="${compiler:sys.shortName}" legalCopyright="..." internalName="${compiler:sys.shortName}" productName="${compiler:sys.shortName}" />
+        <versionInfo include="true" fileVersion="" fileDescription="${compiler:sys.shortName}" legalCopyright="$$COPYRIGHT_MESSAGE$$" internalName="${compiler:sys.shortName}" productName="${compiler:sys.shortName}" />
       </executable>
       <splashScreen show="false" width="640" height="480" bitmapFile="../../resources/images/jalview_logo_background_fade-640x480.png" textOverlay="true">
         <text>
         <file path="../../resources/images/JalviewLogo_Huge.png" />
       </iconImageFiles>
     </launcher>
-    <launcher name="Network Jalview Launcher" id="1402" customizedId="" external="false" excludeFromMenu="false" unixMode="755" unixAutoStart="true" menuName="${compiler:sys.shortName}" icnsFile="../../resources/images/jalview_logos.icns" customMacBundleIdentifier="false" macBundleIdentifier="" swtApp="false" fileset="" macBundleBinary="JavaApplicationStub" addMacEntitlements="false" macEntitlementsFile="" useCustomMacosExecutableName="true" customMacosExecutableName="${compiler:sys.shortName}" useJavaMinVersionOverride="false" javaMinVersionOverride="" useJavaMaxVersionOverride="false" javaMaxVersionOverride="" checkUpdater="false" updateExecutionMode="unattendedProgress" unattendedUpdateTitle="${i18n:updater.WindowTitle(&quot;${compiler:sys.fullName}&quot;)}">
+    <launcher name="Network Jalview Launcher" id="1402" customizedId="" external="false" excludeFromMenu="false" unixMode="755" unixAutoStart="true" menuName="${compiler:sys.shortName}" icnsFile="../../resources/images/jalview_logos.icns" customMacBundleIdentifier="true" macBundleIdentifier="$$MACOS_BUNDLE_ID$$" swtApp="false" fileset="" macBundleBinary="JavaApplicationStub" addMacEntitlements="false" macEntitlementsFile="" useCustomMacosExecutableName="true" customMacosExecutableName="${compiler:sys.shortName}" useJavaMinVersionOverride="false" javaMinVersionOverride="" useJavaMaxVersionOverride="false" javaMaxVersionOverride="" checkUpdater="false" updateExecutionMode="unattendedProgress" unattendedUpdateTitle="${i18n:updater.WindowTitle(&quot;${compiler:sys.fullName}&quot;)}">
       <executable name="Jalview" type="1" iconSet="true" iconFile="../../resources/images/jalview_logos.ico" executableDir="." redirectStderr="true" stderrFile="error.log" stderrMode="overwrite" redirectStdout="true" stdoutFile="output.log" stdoutMode="overwrite" failOnStderrOutput="true" executableMode="1" changeWorkingDirectory="true" workingDirectory="." singleInstance="true" serviceStartType="2" serviceDependencies="" serviceDescription="" jreLocation="" executionLevel="asInvoker" checkConsoleParameter="true" globalSingleInstance="false" singleInstanceActivate="true" dpiAware="java9+">
-        <versionInfo include="true" fileVersion="" fileDescription="${compiler:sys.shortName}" legalCopyright="..." internalName="${compiler:sys.shortName}" productName="${compiler:sys.shortName}" />
+        <versionInfo include="true" fileVersion="" fileDescription="${compiler:sys.shortName}" legalCopyright="$$COPYRIGHT_MESSAGE$$" internalName="${compiler:sys.shortName}" productName="${compiler:sys.shortName}" />
       </executable>
       <splashScreen show="false" width="640" height="480" bitmapFile="../../resources/images/jalview_logo_background_fade-640x480.png" textOverlay="true">
         <text>
       </iconImageFiles>
     </launcher>
   </launchers>
-  <installerGui installerType="1" addOnAppId="" suggestPreviousLocations="true" autoUpdateDescriptorUrl="" useAutoUpdateBaseUrl="false" autoUpdateBaseUrl="">
+  <installerGui installerType="1" addOnAppId="" suggestPreviousLocations="true" autoUpdateDescriptorUrl="https://www.jalview.org/install4j/updates.xml" useAutoUpdateBaseUrl="false" autoUpdateBaseUrl="">
     <staticMembers script="" />
     <customCode />
     <autoUpdate useMinUpdatableVersion="false" minUpdatableVersion="" useMaxUpdatableVersion="false" maxUpdatableVersion="">
                     <void property="enabledTitleText">
                       <boolean>false</boolean>
                     </void>
-                    <void property="labelText">
-                      <string>install4j</string>
-                    </void>
                   </object>
                 </java>
               </serializedBean>
@@ -580,6 +577,9 @@ return console.askOkCancel(message, true);
                       <void property="fillVertical">
                         <boolean>true</boolean>
                       </void>
+                      <void property="showSelectionButtons">
+                        <boolean>true</boolean>
+                      </void>
                     </object>
                   </java>
                 </serializedBean>
@@ -710,6 +710,11 @@ return console.askOkCancel(message, true);
                       <void property="description">
                         <string>${compiler:sys.shortName}</string>
                       </void>
+                      <void property="file">
+                        <object class="java.io.File">
+                          <string>${compiler:sys.shortName}</string>
+                        </object>
+                      </void>
                       <void property="name">
                         <string>${compiler:sys.fullName}</string>
                       </void>
@@ -720,7 +725,7 @@ return console.askOkCancel(message, true);
                       </void>
                       <void property="winIconFile">
                         <object class="com.install4j.api.beans.ExternalFile">
-                          <string>../../resources/images/JalviewLogo_Huge.png</string>
+                          <string>../../resources/images/jalview_logos.ico</string>
                         </object>
                       </void>
                     </object>
@@ -747,10 +752,10 @@ return console.askOkCancel(message, true);
                   <java class="java.beans.XMLDecoder">
                     <object class="com.install4j.runtime.beans.actions.desktop.CreateFileAssociationAction">
                       <void property="description">
-                        <string>EXTENSIONS_REPLACED_BY_GRADLE</string>
+                        <string>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'.</string>
                       </void>
                       <void property="extension">
-                        <string>EXTENSION</string>
+                        <string>extensions_to_be_replaced_by_gradle</string>
                       </void>
                     </object>
                   </java>
@@ -817,7 +822,7 @@ return console.askOkCancel(message, true);
           </screen>
         </screens>
       </application>
-      <application name="" id="uninstaller" customizedId="" beanClass="com.install4j.runtime.beans.applications.UninstallerApplication" enabled="true" commentSet="false" comment="" actionElevationType="none" styleId="41" fileset="" customIcnsFile="" customIcoFile="" macEntitlementsFile="" automaticLauncherIntegration="false" launchMode="startupFirstWindow" launchInNewProcess="true" launchSchedule="updateSchedule" allLaunchers="true">
+      <application name="" id="uninstaller" customizedId="" beanClass="com.install4j.runtime.beans.applications.UninstallerApplication" enabled="true" commentSet="false" comment="" actionElevationType="none" styleId="35" fileset="" customIcnsFile="" customIcoFile="" macEntitlementsFile="" automaticLauncherIntegration="false" launchMode="startupFirstWindow" launchInNewProcess="true" launchSchedule="updateSchedule" allLaunchers="true">
         <serializedBean>
           <java class="java.beans.XMLDecoder">
             <object class="com.install4j.runtime.beans.applications.UninstallerApplication">
@@ -926,7 +931,7 @@ return console.askOkCancel(message, true);
           </screen>
         </startup>
         <screens>
-          <screen name="" id="24" customizedId="" beanClass="com.install4j.runtime.beans.screens.UninstallWelcomeScreen" enabled="true" commentSet="false" comment="" actionElevationType="inherit" styleId="41" rollbackBarrier="false" rollbackBarrierExitCode="0" backButton="2" finishScreen="false" wizardIndexChangeType="unchanged" wizardIndexKey="">
+          <screen name="" id="24" customizedId="" beanClass="com.install4j.runtime.beans.screens.UninstallWelcomeScreen" enabled="true" commentSet="false" comment="" actionElevationType="inherit" styleId="" rollbackBarrier="false" rollbackBarrierExitCode="0" backButton="2" finishScreen="false" wizardIndexChangeType="unchanged" wizardIndexKey="">
             <serializedBean>
               <java class="java.beans.XMLDecoder">
                 <object class="com.install4j.runtime.beans.screens.UninstallWelcomeScreen" />
@@ -1010,12 +1015,24 @@ return console.askYesNo(message, true);
                 </serializedBean>
                 <condition />
               </action>
+              <action name="" id="660" customizedId="" beanClass="com.install4j.runtime.beans.actions.control.SetProgressAction" enabled="false" commentSet="false" comment="" actionElevationType="none" rollbackBarrier="false" rollbackBarrierExitCode="0" multiExec="false" failureStrategy="1" errorMessage="">
+                <serializedBean>
+                  <java class="java.beans.XMLDecoder">
+                    <object class="com.install4j.runtime.beans.actions.control.SetProgressAction">
+                      <void property="percentValue">
+                        <int>95</int>
+                      </void>
+                    </object>
+                  </java>
+                </serializedBean>
+                <condition />
+              </action>
               <action name="" id="1525" customizedId="" beanClass="com.install4j.runtime.beans.actions.files.DeleteFileAction" enabled="true" commentSet="false" comment="" actionElevationType="elevated" rollbackBarrier="false" rollbackBarrierExitCode="0" multiExec="false" failureStrategy="1" errorMessage="">
                 <serializedBean>
                   <java class="java.beans.XMLDecoder">
                     <object class="com.install4j.runtime.beans.actions.files.DeleteFileAction">
                       <void property="files">
-                        <array class="java.io.File" length="11">
+                        <array class="java.io.File" length="17">
                           <void index="0">
                             <object class="java.io.File">
                               <string>jre</string>
@@ -1071,6 +1088,36 @@ return console.askYesNo(message, true);
                               <string>*.txt</string>
                             </object>
                           </void>
+                          <void index="11">
+                            <object class="java.io.File">
+                              <string>*_new</string>
+                            </object>
+                          </void>
+                          <void index="12">
+                            <object class="java.io.File">
+                              <string>digest.txt</string>
+                            </object>
+                          </void>
+                          <void index="13">
+                            <object class="java.io.File">
+                              <string>digest2.txt</string>
+                            </object>
+                          </void>
+                          <void index="14">
+                            <object class="java.io.File">
+                              <string>getdown-launcher.jarv</string>
+                            </object>
+                          </void>
+                          <void index="15">
+                            <object class="java.io.File">
+                              <string>launcher.log</string>
+                            </object>
+                          </void>
+                          <void index="16">
+                            <object class="java.io.File">
+                              <string>proxy.txt</string>
+                            </object>
+                          </void>
                         </array>
                       </void>
                       <void property="recursive">
@@ -1081,7 +1128,7 @@ return console.askYesNo(message, true);
                 </serializedBean>
                 <condition />
               </action>
-              <action name="" id="660" customizedId="" beanClass="com.install4j.runtime.beans.actions.control.SetProgressAction" enabled="true" commentSet="false" comment="" actionElevationType="none" rollbackBarrier="false" rollbackBarrierExitCode="0" multiExec="false" failureStrategy="1" errorMessage="">
+              <action name="" id="1791" customizedId="" beanClass="com.install4j.runtime.beans.actions.control.SetProgressAction" enabled="true" commentSet="false" comment="" actionElevationType="none" rollbackBarrier="false" rollbackBarrierExitCode="0" multiExec="false" failureStrategy="1" errorMessage="">
                 <serializedBean>
                   <java class="java.beans.XMLDecoder">
                     <object class="com.install4j.runtime.beans.actions.control.SetProgressAction">
@@ -1218,9 +1265,6 @@ return console.askYesNo(message, true);
                       <void property="enabledTitleText">
                         <boolean>false</boolean>
                       </void>
-                      <void property="labelText">
-                        <string>install4j</string>
-                      </void>
                     </object>
                   </java>
                 </serializedBean>