JAL-3631 Allow use of ~/ for unixBinDir specified in response.varfile feature/JAL-3631_allow_jalview_to_work_from_user-space_directory
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 28 Aug 2024 12:54:18 +0000 (13:54 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Wed, 28 Aug 2024 12:54:18 +0000 (13:54 +0100)
utils/install4j/install4j10_template.install4j

index c5d1460..9531fc6 100644 (file)
@@ -719,8 +719,18 @@ return null;
                   </property>
                   <property name="variableName" type="string">unixBinDir</property>
                 </serializedBean>
-                <condition>context.getBooleanVariable("makeSymbolicLink")
-&amp;&amp; (context.getVariable("unixBinDir") == null || context.getVariable("unixBinDir").toString().length() == 0)</condition>
+                <condition>if (!context.getBooleanVariable("makeSymbolicLink")) {
+    return false;
+}
+String unixBinDir = (String) context.getVariable("unixBinDir");
+if (unixBinDir != null &amp;&amp; unixBinDir.length() &gt; 0) {
+    if (unixBinDir.startsWith("~/")) {
+        unixBinDir = (String)context.getVariable("sys.userHome") + unixBinDir.substring(1);
+        context.setVariable("unixBinDir", unixBinDir);
+    }
+    return false;
+}
+return true;</condition>
               </action>
               <action name="USERSPACE: Set MacOSDir (macOS)" id="2745" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
                 <serializedBean>