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 for i in ${!iparams[@]}; do
24 # echo $i "=>" "${iparams[$i]}"
25 case "${iparams[$i]}" in
26 --file=/*|--export-pdf=/*|--export-eps=/*|--export-png=/*|--export-emf=/*|--export-wmf=/*|--export-ps=/*|--export-ps-level=/*|--export-pdf-version=/*)
27 oparams+=( "${iparams[$i]}" )
29 --file=*|--export-pdf=*|--export-eps=*|--export-png=*|--export-emf=*|--export-wmf=*|--export-ps=*|--export-ps-level=*|--export-pdf-version=*)
30 oparams+=( "${iparams[$i]//=/=${pwd}/}" )
33 # ignore this argument - its provided below anyway
36 oparams+=( "${iparams[$i]}" )
40 exec "${inkscape}" --without-gui "${oparams[@]}"
43 # try to find the inkscape installation...
44 # at first try the well known location
45 RESDIR="/Applications/Inkscape.app/Contents/Resources"
46 if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
47 startinkscape "${RESDIR}"/bin/inkscape "$@"
50 # this failed... so try PATH expansion to start the inkscape shell wrapper
51 IFS=":" read -ra DIRLIST <<< "${PATH}"
52 for BINDIR in "${DIRLIST[@]}" ; do
53 RESDIR=$(dirname "${BINDIR}")
54 if [ -f "${RESDIR}"/bin/inkscape -a -x "${RESDIR}"/bin/inkscape ]; then
55 startinkscape "${RESDIR}"/bin/inkscape "$@"
59 # report error and exit with failure status
61 echo Could not find Inkscape binary.