4 # wrapper start script for Inkscape.app on Mac
6 # This file is part of LyX, the document processor.
7 # Licence details can be found in the file COPYING.
10 # Full author contact details are available in file CREDITS.
14 # check for file arguments with relative path names
15 # convert them to absolute path names
16 # inkscape on Mac changes the working directory
17 # this invalidates relative path names
23 # pre 1.0 application has cmd line utility in resources
24 # this utility needs the explicit option to suppress gui
25 # 1.0 don't have it and fails to start with it
31 for i in ${!iparams[@]}; do
32 # echo $i "=>" "${iparams[$i]}"
33 case "${iparams[$i]}" in
34 --file=/*|--export-pdf=/*|--export-eps=/*|--export-png=/*|--export-emf=/*|--export-wmf=/*|--export-ps=/*|--export-ps-level=/*|--export-pdf-version=/*)
35 oparams+=( "${iparams[$i]}" )
37 --file=*|--export-pdf=*|--export-eps=*|--export-png=*|--export-emf=*|--export-wmf=*|--export-ps=*|--export-ps-level=*|--export-pdf-version=*)
38 oparams+=( "${iparams[$i]//=/=${pwd}/}" )
41 # ignore this argument - its provided below anyway
44 oparams+=( "${iparams[$i]}" )
48 exec "${inkscape}" ${wogui} "${oparams[@]}"
51 # try to find the inkscape installation...
52 # at first try the well known location for Inkscape 1.0
53 # but check for Inkscape 0.92.x too and skip this if it's in Resources
54 RESDIR="/Applications/Inkscape.app/Contents/MacOS"
55 if [ ! -f "/Applications/Inkscape.app/Contents/Resources/bin/inkscape" -a -f "${RESDIR}"/inkscape -a -x "${RESDIR}"/inkscape ]; then
56 startinkscape "${RESDIR}"/inkscape "$@"
59 # this failed... so try PATH expansion to start the inkscape shell wrapper
60 # Now continue the check with pre 1.0 inkscape application and the PATH
61 IFS=":" read -ra DIRLIST <<< "${PATH}"
62 for BINDIR in "/Applications/Inkscape.app/Contents/Resources/bin" "${DIRLIST[@]}" ; do
63 RESDIR=$(dirname "${BINDIR}")
64 if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
65 startinkscape "${RESDIR}"/bin/inkscape "$@"
69 # report error and exit with failure status
71 echo Could not find Inkscape binary.