g_get_home_dir, g_get_tmp_dir



I think some specification for the semantics of g_get_home_dir and
g_get_tmp_dir should be decided upon. In my gimp for Windows work, I
had assumed that g_get_home_dir can and should return an empty string
if the user has no recognisable home directory (as typically is the
case on single-user Windoze machines).

(I already have code in gimp for Windows that takes this into
consideration, and uses the gimp installation directory for per-user
rc files in that case.)

When applying the Windows patch to GLib, however, g_get_home_dir was
changed to return the same as g_get_tmp_dir always on Windows. (Becase
g_get_any_init was changed to always set g_home_dir to NULL on
Windows, even if the HOME env var exists.) (I mean, it was not like
that in my suggested patch, but TJ changed it that way.) Is this
really a good idea?

I think this is how g_get_home_dir should work:

/* Return the home directory of the user. If there is a HOME
 * environment variable, its value is returned, otherwise use some
 * system-dependent way of finding it out. If no home directory can be
 * deduced, return an empty string.
 */

And g_get_tmp_dir:

/* Return a directory to be used to temporary files. This is the value
 * of the TMPDIR, TMP or TEMP environment variables (they are checked
 * in that order). If none of those exist, return "/tmp" on POSIXly
 * systems, and "." (the current directory) on Windows.
 */

--tml



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