Re: g_get_home_dir (), ${HOME}, and getpwuid ()->pw_dir



>>>>> Debarshi Ray <rishi is lostca se> writes:

 >> Also to note is that non-GNOME (and even "non-desktop") GLib-based
 >> applications were seen in the wild.  Consider, e. g., the OpenBSD
 >> version of the Netcat command-line networking diagnostic tool (as of
 >> the version currently in Debian stable [4].)  And I'm not yet sure
 >> that the developers of these packages will be eager to implement the
 >> support for the aforementioned variables.

 > Git supports them:

 > https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.12.txt#L18-23

	ACK, thanks for the information.

	However, contrary to GLib, Git actually follows the
	specification [1] by falling back to ${HOME}/.config should
	XDG_CONFIG_HOME be unavailable.  It doesn't seem to use
	getpwuid () there at all.

--cut: https://raw.github.com/git/git/master/path.c --
void home_config_paths(char **global, char **xdg, char *file)
{
	char *xdg_home = getenv("XDG_CONFIG_HOME");
	char *home = getenv("HOME");
	char *to_free = NULL;

...
		if (!xdg_home) {
			to_free = mkpathdup("%s/.config", home);
			xdg_home = to_free;
		}
...
}
--cut: https://raw.github.com/git/git/master/path.c --

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html

-- 
FSF associate member #7257



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