JAL-3845 Add a popup error message, with instructions, when Jalview launched from...
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 13 Jun 2024 20:20:54 +0000 (21:20 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 13 Jun 2024 20:20:54 +0000 (21:20 +0100)
src/jalview/bin/Jalview.java

index 92ac5fc..148f9c0 100755 (executable)
@@ -706,6 +706,8 @@ public class Jalview implements JalviewObjectI
        */
       {
 
+        String appName = ChannelProperties.getProperty("app_name");
+
         /**
          * Check to see that the JVM version being run is suitable for the Java
          * version this Jalview was compiled for. Popup a warning if not.
@@ -714,7 +716,8 @@ public class Jalview implements JalviewObjectI
         {
           Console.warn("The Java version being used (Java "
                   + LaunchUtils.getJavaVersion()
-                  + ") may lead to problems. This installation of Jalview should be used with Java "
+                  + ") may lead to problems. This installation of "
+                  + appName + " should be used with Java "
                   + LaunchUtils.getJavaCompileVersion() + ".");
 
           if (!LaunchUtils
@@ -734,6 +737,29 @@ public class Jalview implements JalviewObjectI
           }
         }
 
+        /**
+         * Check to see if we've been launched from the installer volume
+         * (macOS).
+         */
+        String installerappdirString = System
+                .getProperty("installer.appdir");
+        if (Platform.isMac() && installerappdirString != null
+                && installerappdirString.startsWith("/Volumes/"))
+        {
+          Console.warn("You appear to be running " + appName
+                  + " from the Installer volume.  Please drag and drop the "
+                  + appName + " icon into the Applications folder.");
+
+          Object[] options = { MessageManager.getString("action.quit") };
+          JOptionPane.showOptionDialog(null, MessageManager.formatMessage(
+                  "warning.running_from_installer_volume_message", appName),
+                  MessageManager.getString(
+                          "warning.running_from_installer_volume_title"),
+                  JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
+                  null, options, options[0]);
+          quit();
+        }
+
         boolean webservicediscovery = bootstrapArgs
                 .getBoolean(Arg.WEBSERVICEDISCOVERY);
         if (aparser.contains("nowebservicediscovery"))