}
}
- def getdownWrapperScripts = [ getdown_mac_wrapper_script, getdown_unix_wrapper_script ]
+ def getdownWrapperScripts = [ getdown_mac_wrapper_script, getdown_unix_wrapper_script, getdown_windows_wrapper_script ]
getdownWrapperScripts.each{ script ->
def s = file( "${jalviewDir}/utils/getdown/${script}" )
if (s.exists()) {
install4j_dmg_wrapper_link = jalviewc
getdown_mac_wrapper_script = jalviewc-macos
getdown_unix_wrapper_script = jalviewc
+getdown_windows_wrapper_script = jalviewc.ps1
OSX_KEYSTORE =
OSX_KEYPASS =
#!/usr/bin/env bash
ARG1=$1
-WDIR="$( pwd )"
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
+DIR="$(dirname "$(readlink -f "$0")")"
# check to see if $1 is set and is not start of other cli set args
OPEN=""
-if [ -n "$ARG1" -a "$ARG1" = "${ARG1#-}" -a \! "$ARG1" = "open" ]; then
+if [ -n "${ARG1}" -a "${ARG1}" = "${ARG1#-}" -a "${ARG1}" != "open" ]; then
# first argument exists and does not start with a "-" and is not "open"
OPEN="-open"
fi
APPDIR="${DIR}"
JAVA="${APPDIR}/jre/bin/java"
GETDOWNTXT="${APPDIR}/getdown.txt"
-if [ -e "$GETDOWNTXT" ]; then
- CLASSPATH=""
- for x in $(grep -e 'code = ' "${GETDOWNTXT}" | sed -e 's/^code\s*=\s*//;'); do
- [ -n "$CLASSPATH" ] && CLASSPATH="${CLASSPATH}:"
- CLASSPATH="${CLASSPATH}${APPDIR}/${x}"
+CLASSPATH=""
+if [ -e "${GETDOWNTXT}" ]; then
+ for JAR in $(grep -e '^code\s*=\s*' "${GETDOWNTXT}" | sed -e 's/^code\s*=\s*//;'); do
+ [ -n "${CLASSPATH}" ] && CLASSPATH="${CLASSPATH}:"
+ CLASSPATH="${CLASSPATH}${APPDIR}/${JAR}"
done
else
echo "Cannot find getdown.txt" >&2
- exit 1
+ exit 3
fi
-"$JAVA" -cp "$CLASSPATH" jalview.bin.Launcher $OPEN "$@"
+if [ \! -e "${JAVA}" ]; then
+ echo "Cannot find bundled java, using system and hoping for the best!" >&2
+ JAVA=java
+fi
+
+# don't quote $OPEN
+"${JAVA}" -cp "${CLASSPATH}" jalview.bin.Launcher ${OPEN} "$@"
#!/usr/bin/env bash
-ARG1=$1
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
-APP=${DIR%/Contents/*}
+ARG1="$1"
+
+# this whole next part is because there's no readlink -f in Darwin
+function readlinkf() {
+ FINDFILE="$1"
+ FILE="${FINDFILE}"
+ PREVFILE=""
+ C=0
+ MAX=100 # just in case we end up in a loop
+ FOUND=0
+ while [ "${C}" -lt "${MAX}" -a "${FILE}" != "${PREVFILE}" -a "${FOUND}" -ne 1 ]; do
+ PREVFILE="${FILE}"
+ FILE="$(readlink "${FILE}")"
+ if [ -z "${FILE}" ]; then
+ # the readlink is empty means we've arrived at the script, let's canonicalize with pwd
+ FILE="$(cd "$(dirname "${PREVFILE}")" &> /dev/null && pwd -P)"/"$(basename "${PREVFILE}")"
+ FOUND=1
+ elif [ "${FILE#/}" = "${FILE}" ]; then
+ # FILE is not an absolute path link, we need to add the relative path to the previous dir
+ FILE="$(dirname "${PREVFILE}")/${FILE}"
+ fi
+ C=$((C+1))
+ done
+ if [ "${FOUND}" -ne 1 ]; then
+ echo "Could not determine path to actual file '$(basename "${FINDFILE}")'" >&2
+ exit 1
+ fi
+ echo "${FILE}"
+}
+
+DIR="$(dirname "$(readlinkf "$0")")"
+APP="${DIR%.app/Contents/*}".app
if [ "${APP}" = "${APP%.app}" ]; then
- echo "Could not find .app dir" >&2
- exit 1
+ echo "Could not find Jalview.app dir" >&2
+ exit 2
fi
# check to see if $1 is set and is not start of other cli set args
OPEN=""
-if [ -n "$ARG1" -a "$ARG1" = "${ARG1#-}" -a \! "$ARG1" = "open" ]; then
+if [ -n "${ARG1}" -a "${ARG1}" = "${ARG1#-}" -a "${ARG1}" != "open" ]; then
# first argument exists and does not start with a "-" and is not "open"
OPEN="-open"
fi
APPDIR="${APP}/Contents/Resources/app"
JAVA="${APPDIR}/jre/Contents/Home/bin/java"
GETDOWNTXT="${APPDIR}/getdown.txt"
-# always check grep and sed regexes on macOS -- they're not the same
-if [ -e "$GETDOWNTXT" ]; then
- CLASSPATH=""
- for x in $(grep -e 'code = ' "${GETDOWNTXT}" | sed -e 's/^code\s*=\s*//;'); do
- [ -n "$CLASSPATH" ] && CLASSPATH="${CLASSPATH}:"
- CLASSPATH="${CLASSPATH}${APPDIR}/${x}"
+CLASSPATH=""
+if [ -e "${GETDOWNTXT}" ]; then
+ # always check grep and sed regexes on macOS -- they're not the same
+ for JAR in $(grep -e '^code\s*=\s*' "${GETDOWNTXT}" | sed -e 's/^code\s*=\s*//;'); do
+ [ -n "${CLASSPATH}" ] && CLASSPATH="${CLASSPATH}:"
+ CLASSPATH="${CLASSPATH}${APPDIR}/${JAR}"
done
else
echo "Cannot find getdown.txt" >&2
- exit 1
+ exit 3
+fi
+
+if [ \! -e "${JAVA}" ]; then
+ echo "Cannot find bundled java, using system and hoping for the best!" >&2
+ JAVA=java
fi
-"$JAVA" -cp "$CLASSPATH" jalview.bin.Launcher $OPEN "$@"
+# don't quote $OPEN
+"${JAVA}" -Xdock:icon="${APPDIR}"/resource/jalview_logo.png -cp "${CLASSPATH}" jalview.bin.Launcher ${OPEN} "$@"
--- /dev/null
+# save first parameter
+$ARGS = $args
+$ARG1 = $args[0]
+# parent dir of this script (should be the getdown app dir)
+$DIR = Split-Path $MyInvocation.MyCommand.Path -Parent
+
+# insert an "-open" parameter to Jalview's ARGS if ARG1 is non-zero-length, and not "open" or starts with a "-"
+if ( $ARG1.length -gt 0 -and (-not $ARG1.StartsWith("-")) -and $ARG1 -ne "open" ) {
+ $ARGS = "-open " + $ARGS
+}
+
+$APPDIR = $DIR
+$JAVA = "${APPDIR}/jre/bin/java.exe"
+$GETDOWNTXT = "${APPDIR}/getdown.txt"
+
+if (-not (Test-Path -Path "${GETDOWNTXT}")) {
+ throw "Cannot find getdown.txt"
+}
+
+if (-not (Test-Path -Path "${JAVA}")) {
+ Write-Host "Cannot find bundled java.exe. Using system and hoping for the best!"
+ $JAVA = "java.exe"
+}
+
+$CLASSPATH = (Select-String -Path "${GETDOWNTXT}" -AllMatches -Pattern "code\s*=\s*(.*)$" | foreach { "$DIR/$($_.Matches.Groups[1].Value)" }) -join ":"
+
+Invoke-Expression -Command "${JAVA} -cp ${CLASSPATH} jalview.bin.Launcher $ARGS"
+