diff --git a/development/MacOSX/LyX.app/Contents/MacOS/lyxeditor b/development/MacOSX/LyX.app/Contents/MacOS/lyxeditor index 749b6bde8f..0583223e14 100755 --- a/development/MacOSX/LyX.app/Contents/MacOS/lyxeditor +++ b/development/MacOSX/LyX.app/Contents/MacOS/lyxeditor @@ -1,16 +1,91 @@ #!/bin/sh # ron@18james.com, 11 Dec 2003 -# With modifications by Bennett Helm +# With modifications by Angus Leeming, tweaked by Bennett Helm 21 Jan 2007 + +parse_serverpipe() +{ + test -r "$1" || { + echo "Usage: parse_serverpipe lyxrc" >&2 + exit 1 + } + + # The output of this sed script is output to STDOUT + LYXPIPE=`sed -n '/^\\\\serverpipe /{ +# First consider that the file path may be quoted +s/^ *\\\\serverpipe \{1,\}\"\([^"]\{1,\}\)\" *$/\1/ +tfound + +# Now, unquoted +s/^ *\\\\serverpipe \{1,\}\(.*\)/\1/ +s/ *$// + +:found +# Change from single to double shell quoting temporarily... +'" +s@^~/@${HOME}/@ +# Revert to single shell quotes +"' + +p +q +}' "$1"` + + echo "${LYXPIPE}" + unset LYXPIPE +} + + +USER_SUPPORT="${HOME}/Library/Application Support" +test -d "${USER_SUPPORT}" || { + echo "Something horrible is going on. No user support directory $ {USER_SUPPORT}" >&2 + exit 1 +} + +for LYXDIR in LyX-1.5 LyX-1.4 LyX +do + ABS_USER_LYXDIR="${USER_SUPPORT}/${LYXDIR}" + test -d "${ABS_USER_LYXDIR}" || { + echo "Failed to find ABS_USER_LYXDIR: ${ABS_USER_LYXDIR}" >&2 + continue + } + PREFERENCES="${ABS_USER_LYXDIR}/preferences" + test -r "${PREFERENCES}" || { + echo "Failed to find PREFERENCES: ${PREFERENCES}" >&2 + continue + } + # preferences file exists. + # See if it contains a \\serverpipe entry + # Whether it does or not, break out of the loop because we've + # found the preferences file. + LYXPIPE=`parse_serverpipe "${PREFERENCES}"` + break +done + +echo "preferences file sets lyxpipe as ${LYXPIPE}" + +test -z "${LYXPIPE}" && { + ABS_SYSTEM_LYXDIR='/Applications/LyX.app/Contents/Resources' + test -d "${ABS_SYSTEM_LYXDIR}" || { + echo "Failed to find ABS_SYSTEM_LYXDIR: ${ABS_SYSTEM_LYXDIR}" >&2 + exit 1 + } + LYXRC_DIST="${ABS_SYSTEM_LYXDIR}/lyxrc.dist" + test -r "${LYXRC_DIST}" || { + echo "Failed to find LYXRC_DIST: ${LYXRC_DIST}" >&2 + exit 1 + } + + # lyxrc.dist exists + # See if it contains a \\serverpipe entry + LYXPIPE=`parse_serverpipe "${LYXRC_DIST}"` +} + +echo "Our best guess sets lyxpipe as ${LYXPIPE}" + +# The end -lyxpipe=/Users/$USER/Library/Application\ Support/LyX/.lyxpipe -if [ ! -p $lyxpipe.out ] - then - lyxprefs=`expr "$0" : '\(.*\)MacOS/lyxeditor'`lyx/preferences - lyxpipe=`perl -n -e 'print,exit if s/^.serverpipe\\s+\"(.+)\"/$1/;' ~/Library/Application\ Support/LyX/preferences $lyxprefs` -fi -[ -p $lyxpipe.in ] || exit 0 file=`echo "$1" | sed 's|^/private||'` -echo LYXCMD:macdvix:server-goto-file-row:$file $2 > $lyxpipe.in || exit -read < $lyxpipe.out || exit - +echo "LYXCMD:macdvix:server-goto-file-row:"$file" $2" +echo LYXCMD:macdvix:server-goto-file-row:"$file" $2 > "${LYXPIPE}".in || exit +read < "${LYXPIPE}".out || exit diff --git a/development/MacOSX/LyX.app/Contents/Resources/lyxrc.dist b/development/MacOSX/LyX.app/Contents/Resources/lyxrc.dist index 12ef101c6b..b7b128bf91 100644 --- a/development/MacOSX/LyX.app/Contents/Resources/lyxrc.dist +++ b/development/MacOSX/LyX.app/Contents/Resources/lyxrc.dist @@ -16,8 +16,8 @@ # MISC SECTION ###################################### # -\path_prefix "/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/teTeX/bin/i386-apple-darwin-current:/sw/bin:/sw/sbin:/opt/local/teTeX/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/usr/sbin:/sbin" -\serverpipe "~/Library/Application Support/LyX-1.4/.lyxpipe" +\path_prefix "/usr/texbin:/usr/local/gwTeX/bin/powerpc-apple-darwin-current:/usr/local/gwTeX/bin/i386-apple-darwin-current:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/teTeX/bin/i386-apple-darwin-current:/sw/bin:/sw/sbin:/opt/local/teTeX/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/usr/sbin:/sbin" +\serverpipe "~/Library/Application Support/LyX-1.5/.lyxpipe" \preview on # @@ -52,7 +52,7 @@ # FILE SECTION ###################################### # -\template_path "~/Library/Application Support/LyX-1.4/templates" +\template_path "~/Library/Application Support/LyX-1.5/templates" # # PLAIN TEXT EXPORT SECTION ############################## @@ -79,8 +79,8 @@ # FORMATS SECTION ########################## # -\format "fig" "fig" "FIG" "" "open-x11 && export DISPLAY=:0.0 && xfig" "open-x11 && export DISPLAY=:0.0 && xfig" -\format "rtf" "rtf" "Rich Text Format" "" "open" "open" +\format "fig" "fig" "FIG" "" "open -a X11; export DISPLAY=:0.0; xfig" "open -a X11; export DISPLAY=:0.0; xfig" "vector" + # # CONVERTERS SECTION ##########################