X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=utils%2Fgetdown%2Fbin%2Fjalview.sh;h=9e3a8c72c6be702a61bda802a9bd8f818c139ba7;hb=570267624a5d5e0192895edbd4c25f25f3ea15f0;hp=112c3e64f2ad7e94974ca076d64775a97b8dc704;hpb=9e7c315c6ac828989a2d7f49dcb7e451f38df9ff;p=jalview.git diff --git a/utils/getdown/bin/jalview.sh b/utils/getdown/bin/jalview.sh index 112c3e6..9e3a8c7 100755 --- a/utils/getdown/bin/jalview.sh +++ b/utils/getdown/bin/jalview.sh @@ -65,7 +65,8 @@ CLASSPATH="" declare -a JARPATHS=() 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 +for JAR in $(grep -e '^code[[:space:]]*=[[:space:]]*' "${GETDOWNTXT}" | while read -r line; do echo $line | sed -E -e 's/code[[:space:]]*=[[:space:]]*//;'; done); + do [ -n "${CLASSPATH}" ] && CLASSPATH="${CLASSPATH}:" CLASSPATH="${CLASSPATH}${APPDIR}/${JAR}" JARPATHS=( "${JARPATHS[@]}" "${APPDIR}/${JAR}" ) @@ -77,10 +78,9 @@ fi # WINDOWS ONLY (Cygwin or WSL) # change paths for Cygwin or Windows Subsystem for Linux (WSL) -if [ "${ISMACOS}" != 1 ]; then # macos doesn't like uname -o, best to avoid +if [ "${ISMACOS}" != 1 ]; then # older macos doesn't like uname -o, best to avoid if [ "$(uname -o)" = "Cygwin" ]; then # CYGWIN - echo "When using relative paths in args within Cygwin, please start with './' or '../'" >&2 CLASSPATH=$(cygpath -pw "${CLASSPATH}") # now for some arg paths fun. only translating paths starting with './', '../', '/' or '~' ARGS=() @@ -91,9 +91,8 @@ if [ "${ISMACOS}" != 1 ]; then # macos doesn't like uname -o, best to avoid ARGS=( "${ARGS[@]}" "${ARG}" ) fi done - elif uname -r | grep Microsoft >/dev/null; then + elif uname -r | grep -i microsoft | grep -i wsl >/dev/null; then # WSL - echo "When using relative paths in args within WSL, please start with './' or '../'" >&2 CLASSPATH="" for JARPATH in "${JARPATHS[@]}"; do [ -n "${CLASSPATH}" ] && CLASSPATH="${CLASSPATH};" @@ -115,18 +114,21 @@ if [ "${ISMACOS}" != 1 ]; then # macos doesn't like uname -o, best to avoid fi fi +# get console width -- three ways to try, just in case +if command -v tput 2>&1 >/dev/null; then + COLUMNS=$(tput cols) 2>/dev/null +elif command -v stty 2>&1 >/dev/null; then + COLUMNS=$(stty size | cut -d" " -f2) 2>/dev/null +elif command -v resize 2>&1 >/dev/null; then + COLUMNS=$(resize -u | grep COLUMNS= | sed -e 's/.*=//;s/;//') 2>/dev/null +fi +JVMARGS=( "${JVMARGS[@]}" "-DCONSOLEWIDTH=${COLUMNS}" ) +JVMARGS=( "${JVMARGS[@]}" "-Dgetdownappdir=${APPDIR}" ) + # Is there a bundled Java? If not just try one in the PATH (do need .exe in WSL) if [ \! -e "${JAVA}" ]; then JAVA=$SYSJAVA echo "Cannot find bundled java, using system ${JAVA} and hoping for the best!" >&2 fi -# check to see if $1 is set and is not start of other cli args -OPEN="" -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 - -# don't quote $OPEN (don't want it accidentally mistaken as an empty string arg!) -"${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher ${OPEN} "${ARGS[@]}" +"${JAVA}" "${JVMARGS[@]}" -cp "${CLASSPATH}" jalview.bin.Launcher "${ARGS[@]}"