From: Ben Soares Date: Wed, 17 Mar 2021 23:15:11 +0000 (+0000) Subject: JAL-3830 Allow paths to start with '~'. Make path check more succinct. X-Git-Tag: Release_2_11_2_0~53 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=523a968d3ba314e2c92f9f42556764f219aa6529;p=jalview.git JAL-3830 Allow paths to start with '~'. Make path check more succinct. --- 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}")"