On Wed, Nov 17, 1999 at 05:04:41PM +0100, Jean-Marc Lasgouttes wrote:
> >>>>> "Amir" == Amir Karger <[EMAIL PROTECTED]> writes:
> 
> OK, a simpler way then: is it possible for reLyXmain.pl to know in
> which directory it is? This does not seem like too much to ask... Then
> we could just set $lyxdir to point to that (more or less).
> 
> Doable? Easy?

Oh! You mean where reLyXmain.pl is, not where the reLyX executable itself
is? Hm...

This ought to be doable. It turns out that Perl keeps track of every file
that it includes, so when the reLyX executable says "do reLyXmain.pl", then
the hash %INC stores the full pathname of reLyXmain.pl.

However, that makes things a little recursive. We need $lyxdir to be set by
configure; otherwise, the reLyX executable doesn't know where to find it!
(So, for example, dirname($INC{"reLyXmain.pl"}) is equal to something like
"/usr/local/share/lyx/reLyX". But it's *undefined* until the point where you
actually say "do reLyXmain.pl" which is too late to set lyxdir.)

So, if you're saying that (for the purpose of finding syntax.default) you
want to have a separate lyxdir variable in reLyXmain.pl, which is calculated
from %INC, then yes, I can tell which directory reLyXmain.pl is in. But at
some point, $lyxdir in the reLyX executable needs to be set by configure!

Although you'll probably argue that that's not necessary, because we have
case 4 in reLyX, which takes the executable path and adds
"../share/lyx/reLyX" to it. But there must be some reason we put the
configure stuff in there in the first place, no?

-Amir

Reply via email to