]> git.lyx.org Git - features.git/commitdiff
#11742 adapt inkscape start utility to Inkscape 1.0
authorStephan Witt <switt@lyx.org>
Sun, 17 May 2020 13:15:59 +0000 (15:15 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 18 May 2020 11:20:24 +0000 (13:20 +0200)
(cherry picked from commit 4552d1c75ffd47b3a6a1ef39dfd255c07320a1a7)

development/MacOSX/inkscape

index ca9ef93b68567c4af4dd172c18290086ae184ce7..ff2f8d1fb50d5857a9e53f97a65bc9c126387ba5 100755 (executable)
@@ -20,6 +20,14 @@ startinkscape() {
        pwd=$(pwd)
        iparams=( "$@" )
        oparams=()
+       # pre 1.0 application has cmd line utility in resources
+       # this utility needs the explicit option to suppress gui
+       # 1.0 don't have it and fails to start with it
+       case "${inkscape}" in
+       */Resources/*)
+               wogui="--without-gui"
+               ;;
+       esac
        for i in ${!iparams[@]}; do
                # echo $i "=>" "${iparams[$i]}"
                case "${iparams[$i]}" in
@@ -37,19 +45,20 @@ startinkscape() {
                        ;;
                esac
        done
-       exec "${inkscape}" --without-gui "${oparams[@]}"
+       exec "${inkscape}" ${wogui} "${oparams[@]}"
 }
 
 # try to find the inkscape installation...
-# at first try the well known location
-RESDIR="/Applications/Inkscape.app/Contents/Resources"
-if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
-       startinkscape "${RESDIR}"/bin/inkscape "$@"
+# at first try the well known location for Inkscape 1.0
+RESDIR="/Applications/Inkscape.app/Contents/MacOS"
+if [ -f "${RESDIR}"/inkscape -a -x "${RESDIR}"/inkscape ]; then
+       startinkscape "${RESDIR}"/inkscape "$@"
        exit 0
 fi
 # this failed... so try PATH expansion to start the inkscape shell wrapper
+# Now continue the check with pre 1.0 inkscape application and the PATH
 IFS=":" read -ra DIRLIST <<< "${PATH}"
-for BINDIR in "${DIRLIST[@]}" ; do
+for BINDIR in "/Applications/Inkscape.app/Contents/Resources" "${DIRLIST[@]}" ; do
        RESDIR=$(dirname "${BINDIR}")
        if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
                startinkscape "${RESDIR}"/bin/inkscape "$@"