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

Mike Hearn wrote:
It would be nice if glib could provide something like the following API:

gboolean g_get_absolute_path(gchar *fallback, gchar **out);

which takes a fallback string (typically would be the PREFIX macro as
defined by the build system on UNIX) and a pointer to a pointer which is
set either to be g_strdup(fallback) on systems where this information is
not available, or the absolute path of the calling module on systems where
it is.

I this this is a great idea, I've had to make my own (rather poor) equivalent several times in the past. A high-quality glib version would be great.
I'd vote for PATH searching to go in there too, although I realise it can be unreliable.

A related issue is embedding environment variables in data files so they can refer to other data files. How about adding something to glib which could expand environment variables in a string?


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