Re: where are the files...



On Mon, 15 Jul 2002, Carlos Pereira wrote:

What is the right, elegant, safe, etc...
way to indicate my app where actually are
the help files that the app should read
when the user asks for help?

Here's one approach.

1. Set a default prefix (e.g. /usr/local) in configure.in
2. Allow the user to change this at configure time
3. Have the configure script write out the chosen value of
   prefix into config.h as a #define
4. Include config.h in any files that need to know $prefix
5. Construct the path to the helpfile by concatenating
   $prefix and other relevant stuff

If you want, you can get a bit fancier by letting the user choose a
"datadir" at configure time which could have a quite different path
from the overall "prefix".  Then you'd treat that the same way,
#defining the relevant path in config.h.

If the user moves things after the initial compile/install then the
helpfile won't be found.  Well, they shouldn't move things.  But if
you really want you could allow the user an override for the help path
via an environment variable and/or a menu item that stores the
override value in a config file of some kind.

Allin Cottrell.






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