Re: Should g_get_homedir use $HOME



On Mon, Mar 04, 2002 at 07:04:15PM -0500, Owen Taylor wrote:
>  const char *homedir = g_getenv ("HOME");
>  if (!homedir)
>    homedir = g_get_homedir ();
> 
> Which isn't painful, though a little cumbersome. For the GTK+
> usage of g_get_homedir() we don't lose too much from this change,
> since interesting configuration (theme, keybinding theme,
> UI tweaks) can be done as XSETTINGS on the display.

	I don't think it is cumbersome, I rather think it is the right
behavior.  I would think of g_get_homedir() as the portable call to
getpwuid[_r].  If g_get_homedir accessed $HOME, an application developer
that wants the home directory (and not some fooling with $HOME) has to
call getpwuid[_r] themselves, thus skipping the portability glib was
supposed to provide in the first place.
	IMHO, $HOME is more informational.  I'd not use it for
overriding things, and I would expect programs to use getpwuid[_r] to
look my home dir up (the exception being shell, of course).  This may or
may not be the way the world works, but I would like a portable API for
"get my homedir", even if we let g_get_homedir() access $HOME.  Maybe
g_get_pwuid() or g_get_pwuid_home().

Joel

-- 

"Baby, even the losers
 Get luck sometimes.
 Even the losers
 Keep a little bit of pride."

			http://www.jlbec.org/
			jlbec evilplan org



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