[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Directory names hard-coded in Texinfo Perl scripts
From: |
Eli Zaretskii |
Subject: |
Re: Directory names hard-coded in Texinfo Perl scripts |
Date: |
Fri, 17 Dec 2021 09:29:35 +0200 |
> Date: Thu, 16 Dec 2021 16:21:09 -0800
> From: Per Bothner <per@bothner.com>
>
> On 12/16/21 15:52, Jacob Bachmeyer wrote:
> > If they can have a location fixed relative to the script, the Perl core
> > module FindBin and pragmatic module lib can help here:
>
> Or if using bash or similar you take do something like this,
> which is a simplified version of the Kawa start-up script:
>
> #!/bin/bash
> thisfile=`command -v $0`
> case "$thisfile" in
> "") echo "installation error - can't find path to $0"; exit -1 ;;
> /*) ;;
> *) thisfile="$PWD/$thisfile" ;;
> esac
> while test -L "$thisfile"; do thisfile=$(readlink -f "$thisfile"); done
> kawadir=`dirname "$thisfile" | sed -e 's|/bin\(/\.\)*$||'`
> CLASSPATH="$kawadir/lib/kawa.jar:${CLASSPATH}"
> export CLASSPATH
> exec ${JAVA-java} -Dkawa.home="${kawadir}" kawa.repl "$@"
>
> The idea is you can have:
>
> ANYDIR/bin/kawa
> ANYDIR/lib/kawa.jar
> ANYDIR/share/kawa/...
>
> Then if you execute ANYDIR/bin/kawa directly, or via a symlink,
> or if ANYDIR/bin (or a symlink) is on your PATH the script will set
> $kawadir to ANYDIR. Given that it can find ANYDIR/lib/kawa.jar,
> ANYDIR/share/kawa or other needed files.
Thanks, but AFAIU this still needs changes in the Perl scripts to
honor the FOO.home variables. Right?
Personally, I find the relative-path method much easier, but I will go
with anything Gavin considers as the preferable solution.
- Directory names hard-coded in Texinfo Perl scripts, Eli Zaretskii, 2021/12/16
- Re: Directory names hard-coded in Texinfo Perl scripts, Gavin Smith, 2021/12/16
- Re: Directory names hard-coded in Texinfo Perl scripts, Jacob Bachmeyer, 2021/12/16
- Re: Directory names hard-coded in Texinfo Perl scripts, Per Bothner, 2021/12/16
- Re: Directory names hard-coded in Texinfo Perl scripts, Per Bothner, 2021/12/16
- Re: Directory names hard-coded in Texinfo Perl scripts,
Eli Zaretskii <=
- Re: Directory names hard-coded in Texinfo Perl scripts, Per Bothner, 2021/12/17
- Re: Directory names hard-coded in Texinfo Perl scripts, Eli Zaretskii, 2021/12/17
- Re: Directory names hard-coded in Texinfo Perl scripts, Per Bothner, 2021/12/17
- Re: Directory names hard-coded in Texinfo Perl scripts, Eli Zaretskii, 2021/12/17
- Re: Directory names hard-coded in Texinfo Perl scripts, Patrice Dumas, 2021/12/16
- Re: Directory names hard-coded in Texinfo Perl scripts, Eli Zaretskii, 2021/12/17
- Re: Directory names hard-coded in Texinfo Perl scripts, Gavin Smith, 2021/12/18
- Re: Directory names hard-coded in Texinfo Perl scripts, Eli Zaretskii, 2021/12/18
- Re: Directory names hard-coded in Texinfo Perl scripts, Gavin Smith, 2021/12/18
- Re: Directory names hard-coded in Texinfo Perl scripts, Per Bothner, 2021/12/18