diff --git a/ChangeLog b/ChangeLog index 06b8ea8d9..ab8611fa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-06-18 Matthias Clasen + + * glib/gutils.c (g_get_home_dir): Add some motivation. + 2007-06-18 Matthias Clasen * configure.in: Bump version diff --git a/glib/gutils.c b/glib/gutils.c index 225e3a6fa..4279a2445 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -1769,9 +1769,28 @@ g_get_real_name (void) * * Note that in contrast to traditional UNIX tools, this function * prefers passwd entries over the HOME - * environment variable. + * environment variable. * - * Returns: the current user's home directory. + * One of the reasons for this decision is that applications in many + * cases need special handling to deal with the case where + * HOME is + * + * Not owned by the user + * Not writeable + * Not even readable + * + * Since applications are in general not written + * to deal with these situations it was considered better to make + * g_get_homedir() not pay attention to HOME and to + * return the real home directory for the user. If applications + * want to pay attention to HOME, they can do: + * + * const char *homedir = g_getenv ("HOME"); + * if (!homedir) + * homedir = g_get_homedir (); + * + * + * Returns: the current user's home directory */ G_CONST_RETURN gchar* g_get_home_dir (void)