[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: finding datadir from executable
From: |
Daniel Jacobowitz |
Subject: |
Re: finding datadir from executable |
Date: |
Sat, 11 Sep 2004 00:01:27 -0400 |
User-agent: |
Mutt/1.5.5.1+cvs20040105i |
On Mon, Sep 06, 2004 at 01:42:21PM -0700, Bruce Korb wrote:
> Akim Demaille wrote:
> >
> > >>> "Nicholas" == Nicholas R Markham <address@hidden> writes:
> >
> > > I recently decided to try to apply the suggestion mentioned in section
> > 17.5 of
> > > the autoconf manual - namely, to hardcode only the relative path from
> > prefix to
> > > datadir (or maybe from bindir to datadir) and try to determine prefix at
> > > runtime. However, I'm not sure how to determine prefix at runtime. Can
> > anyone
> > > give me an example of how they did it? Thanks.
> >
> > Bruno Haible has a complete solution IIRC. See GNU Gettext.
>
> Hi Akim!
>
> That, unfortunately, is too convoluted to figure out without real study.
> Without a clear example, I simply find the full, real path of the executable
> and presume that the standard ../share/${program}/ is correct. Probably
> an illuminating example would make life easier..... :-)
If a GPL'd solution is OK, I recommend libiberty. I moved GCC's
make_relative_prefix into libiberty some time ago because I kept
needing this functionality elsewhere.
You give it argv[0], BINDIR, and OTHERDIR; it computes the relative
path between bindir and otherdir, finds your application in $PATH or
similar, and works out the likely location of otherdir.
--
Daniel Jacobowitz
- finding datadir from executable, Nicholas R. Markham, 2004/09/05
- Re: finding datadir from executable, Bob Friesenhahn, 2004/09/05
- Re: finding datadir from executable, Akim Demaille, 2004/09/06
- Re: finding datadir from executable, Ralph Corderoy, 2004/09/11
- Re: finding datadir from executable, Bob Friesenhahn, 2004/09/11
- Re: finding datadir from executable, Andreas Schwab, 2004/09/11
- Re: finding datadir from executable, Ralph Corderoy, 2004/09/11
- Re: finding datadir from executable, Bob Friesenhahn, 2004/09/11
- Re: finding datadir from executable, Andreas Schwab, 2004/09/12