]> git.lyx.org Git - lyx.git/blobdiff - development/MacOSX/inkscape
Translation of new index features step 2
[lyx.git] / development / MacOSX / inkscape
index f1e6ca458fdeadd023eb52b35388b8114e1507d3..4865fde0914eacabd3f9435cc44d6ae10d08f0bf 100755 (executable)
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+# \file inkscape
+# wrapper start script for Inkscape.app on Mac
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
 # \author Stephan Witt
 # Full author contact details are available in file CREDITS.
 
@@ -14,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
@@ -31,19 +45,21 @@ 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
+# but check for Inkscape 0.92.x too and skip this if it's in Resources
+RESDIR="/Applications/Inkscape.app/Contents/MacOS"
+if [ ! -f "/Applications/Inkscape.app/Contents/Resources/bin/inkscape" -a -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/bin" "${DIRLIST[@]}" ; do
        RESDIR=$(dirname "${BINDIR}")
        if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
                startinkscape "${RESDIR}"/bin/inkscape "$@"