gutils: Split out building of g_get_home_dir() path
gutils: Split out building of g_get_home_dir() path

Otherwise we can have problems calling g_get_home_dir() from within a
g_build_*_dir() function elsewhere in gutils.c:
 • There will be a deadlock due to trying to recursively acquire the
   g_utils_global lock.
 • A stale g_home_dir value may be used if a test harness has called
   g_set_user_dirs() in the interim.

Fix that by splitting the code to find/construct the home path out of
g_get_home_dir() into g_build_home_dir(), the same way it’s split for
the other g_get_*() functions. Call g_build_home_dir() from any call
site where the g_utils_global lock is held.

Signed-off-by: Philip Withnall <29c2a2ac2a854b9cf047275aa9de346d096be2e0@endlessm.com>

endlessm/glib,endlessm/glib,endlessm/glib,endlessm/glib,endlessm/glib