On Jan 12, 2007, at 4:10 PM, Angus Leeming wrote:

Ronald Florence <[EMAIL PROTECTED]> writes:
I've been away from this too long to be of much help, but I think the
Mac way of doing this would be to put the users current LyX home
directory in ~/Library/Preferences/LyX.plist...

An alternative that you might consider is to link ~/Library/
Application Support/lyx to the users current home directory.  Then
changing versions is just a matter of linking the current version to
that directory.

Bennett,

if you define in words just what you want, I can whip up the script for you.

Angus -

I thought I did! But let me try to be clearer....

The object is first to find where .lyxpipe.in is located. The possible locations we can anticipate are to be found specified either in the preferences file (located in one of a number of possible LyX User directories) or in LyX.app/Contents/Resources/lyxrc.dist.

So: I'd like to have a line in which I provide an ordered list of possible lyx user directories (LyX-1.5, LyX-1.4, LyX, ...), and then have the script go through these in order looking to see if a preferences file exists in that location. If it does, it should scan for whether \serverpipe is specified and extract the file location; if not, it should move on to the next possible location. If it can't find a location in any of these preferences files, it should read the location from lyxrc.dist.

(Or, better yet, if there's a way of determining which preference file is the one the currently running version of LyX uses ....)

Once .lyxpipe.in is found, the script should direct LyX to go to the appropriate line number ($2) of the relevant file ($1).

(I've copied the current state of the script below.)

Bennett

---------------

#!/bin/sh
# [EMAIL PROTECTED], 11 Dec 2003
# With modifications by Bennett Helm, 12 Jan 2007

lyxpipe=/Users/$USER/Library/Application\ Support/LyX/.lyxpipe

if  [ ! -p "$lyxpipe".in ]
  then
      if [ -a ~/Library/Application\ Support/LyX/preferences ]
        then
lyxpipe=`perl -n -e 'print,exit if s/^.serverpipe\\s+\"(. +)\"/$1/;' ~/Library/Application\ Support/LyX/preferences`
        else
lyxprefs=`expr "$0" : '\(.*\)MacOS/lyxeditor'`Resources/ lyxrc.dist lyxpipe=`perl -n -e 'print,exit if s/^.serverpipe\\s+\"(. +)\"/$1/;' $lyxprefs`
            lyxpipe=/Users/$USER`echo "$lyxpipe" | sed 's|^~||'`
      fi
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

Reply via email to