]> git.lyx.org Git - lyx.git/blobdiff - development/MacOSX/lyxeditor
ctests: invert for new ru example_lyxified.lyx
[lyx.git] / development / MacOSX / lyxeditor
index b31687d1bf6685ab159a711570377d7d1d60c49c..7431b3b99165ee529b34e609b74f56d7f4b1d661 100755 (executable)
@@ -39,8 +39,8 @@ test -d "${USER_SUPPORT}" || {
        exit 1
 }
 
-# we prefere newer lyx releases here... the last should catch all
-for LYXDIR in LyX-2.0* LyX-2* LyX-1.6* LyX-1.5* LyX-1.4* LyX*
+# we prefer newer lyx releases here...
+for LYXDIR in LyX-2.4 LyX-2.3 LyX-2.2 LyX-2.1 LyX-2.0 LyX-1.6 LyX-1.5 LyX-1.4 LyX
 do
        ABS_USER_LYXDIR="${USER_SUPPORT}/${LYXDIR}"
        test -d "${ABS_USER_LYXDIR}" || {
@@ -53,9 +53,9 @@ do
        }
        # 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}"`
+       LYXPIPE=$(parse_serverpipe "${PREFERENCES}")
+       # break if pipe entry and pipe detected
+       # hopefully it's the correct LyX instance...
        if [ -n "$LYXPIPE" -a -p "$LYXPIPE".in ]; then
                break
        fi
@@ -64,7 +64,8 @@ done
 # echo "preferences file sets lyxpipe as ${LYXPIPE}"
 
 test -z "${LYXPIPE}" && {
-       ABS_SYSTEM_LYXDIR='/Applications/LyX.app/Contents/Resources'
+       ABS_SYSTEM_LYXDIR=$(dirname "$0")
+       ABS_SYSTEM_LYXDIR=$(dirname "${ABS_SYSTEM_LYXDIR}")"/Resources"
        test -d "${ABS_SYSTEM_LYXDIR}" || {
                echo "Failed to find ABS_SYSTEM_LYXDIR: ${ABS_SYSTEM_LYXDIR}" >&2
                exit 1
@@ -77,16 +78,18 @@ test -z "${LYXPIPE}" && {
 
        # lyxrc.dist exists
        # See if it contains a \\serverpipe entry
-       LYXPIPE=`parse_serverpipe "${LYXRC_DIST}"`
+       LYXPIPE=$(parse_serverpipe "${LYXRC_DIST}")
 }
 
 if [ -n "$LYXPIPE" -a -p "$LYXPIPE".in ]; then
-       file=`echo "$1" | sed 's|^/private||'`
+       file=$(echo "$1" | sed 's|^/private||')
 
        MAC_LYXPIPE_CONTENTS="LYXCMD:macdvix:server-goto-file-row:$file $2"
        # echo "$MAC_LYXPIPE_CONTENTS"
        echo "$MAC_LYXPIPE_CONTENTS" > "${LYXPIPE}".in || { echo "Cannot write to lyxpipe." ; exit 2 ; }
-       read < "${LYXPIPE}".out || { echo "Cannot read from lyxpipe." ; exit 2 ; }
+       while read line ; do
+               echo LyX said: $line
+       done < "${LYXPIPE}".out || { echo "Cannot read from lyxpipe." ; exit 2 ; }
 else
        echo "Our best guess sets lyxpipe as ${LYXPIPE}"
        echo "But the lyxpipe could not be found."