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 RESDIR="/Applications/Inkscape.app/Contents/MacOS"
54 if [ -f "${RESDIR}"/inkscape -a -x "${RESDIR}"/inkscape ]; then
55 startinkscape "${RESDIR}"/inkscape "$@"
58 # this failed... so try PATH expansion to start the inkscape shell wrapper
59 # Now continue the check with pre 1.0 inkscape application and the PATH
60 IFS=":" read -ra DIRLIST <<< "${PATH}"
61 for BINDIR in "/Applications/Inkscape.app/Contents/Resources/bin" "${DIRLIST[@]}" ; do
62 RESDIR=$(dirname "${BINDIR}")
63 if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
64 startinkscape "${RESDIR}"/bin/inkscape "$@"
68 # report error and exit with failure status
70 echo Could not find Inkscape binary.