From 523a968d3ba314e2c92f9f42556764f219aa6529 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 17 Mar 2021 23:15:11 +0000 Subject: [PATCH] JAL-3830 Allow paths to start with '~'. Make path check more succinct. --- utils/getdown/jalviewc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/getdown/jalviewc b/utils/getdown/jalviewc index 29beb98..08c5494 100755 --- a/utils/getdown/jalviewc +++ b/utils/getdown/jalviewc @@ -82,10 +82,10 @@ if [ "${ISMACOS}" != 1 ]; then # macos doesn't like uname -o, best to avoid # 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 '/' + # now for some arg paths fun. only translating paths starting with './', '../', '/' or '~' ARGS=() for ARG in "${@}"; do - if [ "${ARG}" != "${ARG#./}" -o "${ARG}" != "${ARG#/}" -o "${ARG}" != "${ARG#../}" ]; then + if [ "${ARG}" != "${ARG#@(/|./|../|~)}" ]; then ARGS=( "${ARGS[@]}" "$(cygpath -aw "${ARG}")" ) else ARGS=( "${ARGS[@]}" "${ARG}" ) @@ -101,7 +101,7 @@ if [ "${ISMACOS}" != 1 ]; then # macos doesn't like uname -o, best to avoid done ARGS=() for ARG in "${@}"; do - if [ "${ARG}" != "${ARG#./}" -o "${ARG}" != "${ARG#/}" -o "${ARG}" != "${ARG#../}" ]; then + if [ "${ARG}" != "${ARG#@(/|./|../|~)}" ]; then # annoyingly wslpath does not work if the file doesn't exist! ARGBASENAME="$(basename "${ARG}")" ARGDIRNAME="$(dirname "${ARG}")" -- 1.7.10.2