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

* Laszlo Peter <Laszlo Peter Sun COM> [2004-04-13 23:43:16 +1200]:

> Hmmm... I can't see what's so wrong with config files, though.
> A single non-relocatable config file for all glib apps could
> actually decrease the number of interfaces we currently support,

Well, perhaps we should better talk about a generic config and
location management API, maybe as library libgconfig, etc.

There we'd have a generic handling of locating configfiles and some 
trivial pathes. The code could try several ways, i.e. firstly environment
and then fallback to some dot-files and then something from sysconfdir.

Maybe a function g_cfg_probe(cont char* package) could try the files 
+ read from env: $package."_CONFIG_FILE"
+ filename: $home."/.".$package.".rc"
+ filename: $sysconfdir."/".$package.".rc"

Perhaps on some platforms there could be other probes which try some
locations expected from the binary location.

_THIS_ would really solve the problem and provide a generic tool for
many, many packages, a simple function for looking up the binary location.
The binary location is NOT problem/job itself, but instead just something
which differs between platforms - and that's what I meant when I said 
I do not want glib to degenerate to something like NSPWL.

> > Well, it does, but this seems an awful hack. Having a config file tell the
> > program where it is isn't really portable to Windows either, to be frank.
Why not ?

Doesn't windows support storing and reading files in a hierachical 
namespace ? ;-)

 Enrico Weigelt    ==   metux IT services

  phone:     +49 36207 519931         www:
  fax:       +49 36207 519932         email:     contact metux de
  cellphone: +49 174 7066481
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --

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