Add Mac OS X 11 support to JavaApplicationStub
[fw/altos] / altosui / AltosUI.app / Contents / MacOS / JavaApplicationStub
index 16966918da4e3f715b18f4e71db0714ebb17f56e..0c36006c31e815ae11feb6e328d6d9f95ee4918b 100755 (executable)
@@ -1,4 +1,16 @@
 #!/bin/bash
+#
+# Fix fonts. I don't know why the getting the
+# basename of the app set to . matters, but it does
+#
+case "$0" in
+    /*)
+        cd `dirname "$0"`
+        ./`basename "$0"` "$@"
+        exit $?
+        ;;
+esac
+export FREETYPE_PROPERTIES=truetype:interpreter-version=35
 ##################################################################################
 #                                                                                #
 # universalJavaApplicationStub                                                   #
@@ -532,12 +544,32 @@ if [ -z "${JAVACMD}" ] || [ ! -x "${JAVACMD}" ] ; then
        # find installed JavaVirtualMachines (JDK + JRE)
        allJVMs=()
        # read JDK's from '/usr/libexec/java_home -V' command
-       while read -r line; do
-               version=$(echo $line | awk -F $',' '{print $1;}')
-               path=$(echo $line | awk -F $'" ' '{print $2;}')
-               path+="/bin/java"
-               allJVMs+=("$version:$path")
-       done < <(/usr/libexec/java_home -V 2>&1 | grep '^[[:space:]]')
+       case `sw_vers -productVersion` in
+           10*)
+               # read JDK's from '/usr/libexec/java_home -V' command
+               while read -r line; do
+                   version=$(echo $line | awk -F $',' '{print $1;}')
+                   path=$(echo $line | awk -F $'" ' '{print $2;}')
+                   path+="/bin/java"
+                   allJVMs+=("$version:$path")
+               done < <(/usr/libexec/java_home -V 2>&1 | grep '^[[:space:]]')
+               ;;
+           *)
+               # read JDK's from java_home -X command
+               while read version path; do
+                   path+="/bin/java"
+                   allJVMs+=("$version:$path")
+               done < <(/usr/libexec/java_home -X |
+                            awk '/<dict>/ { version = ""; path = ""; }
+                                 /<key>/ { key=$1; sub(/<key>/, "", key); sub(/<\/key>/, "", key); }
+                                 /<string>/ { string=$1; sub(/<string>/, "", string); sub(/<\/string>/, "", string);
+                                               if (key == "JVMHomePath") path = string;
+                                               if (key == "JVMVersion") version = string;
+                                            }
+                                 /<\/dict>/ { if (version != "" && path != "") printf("%s %s\n", version, path); }')
+               ;;
+       esac
+
        # unset while loop variables
        unset version path
 
@@ -554,6 +586,7 @@ if [ -z "${JAVACMD}" ] || [ ! -x "${JAVACMD}" ] ; then
        # debug output
        for i in "${allJVMs[@]}"
        do
+           echo "found JVM $i"
                stub_logger "[JavaSearch] ... found JVM: $i"
        done