Re: Proposal: an addition to glib for getting the absolute path of the current binary.



Sven Neumann wrote:

Hi,

I am not convinced that locating the binary file does solve the
problem of locating the data and configuration files. Is there a
reliable way to determine these directories when the path of the
executable is known? I don't think so. The software might have been
compiled with --datadir set to something completely unrelated. Same
goes for configuration files.  It's common practise to call configure
with --sysconfdir=/etc.  How is your proposal for relocatable packages
going to deal with this?
The simplest approach for this would be something like this:

  1. get the executable's path
  2. if the path for the executable matches the configure time
     defaults, use the configure time defaults for things like sysconfdir
  3. if the path doesn't match, assume that prefix is ".." relative to
     the executable's path, and datadir=$prefix/share, etc.

Does this sound workable?

James.

--
Email: james daa com au
WWW:   http://www.daa.com.au/~james/





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]