gutils: replace direct references to g_home_dir

Some code was directly calling g_get_any_init() and then expecting to be
able to use the static 'g_home_dir' variable directly.  Change these
over to g_get_home_dir() instead.
This commit is contained in:
Ryan Lortie
2013-02-04 14:40:03 +01:00
parent 6f7d4e84f2
commit 73e1b17115

View File

@@ -1208,13 +1208,10 @@ g_get_user_data_dir (void)
#endif
if (!data_dir || !data_dir[0])
{
g_get_any_init ();
if (g_home_dir)
data_dir = g_build_filename (g_home_dir, ".local",
"share", NULL);
if (g_get_home_dir ())
data_dir = g_build_filename (g_get_home_dir (), ".local", "share", NULL);
else
data_dir = g_build_filename (g_get_tmp_dir (), g_user_name, ".local", "share", NULL);
data_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".local", "share", NULL);
}
g_user_data_dir = data_dir;
@@ -1244,12 +1241,10 @@ g_init_user_config_dir (void)
#endif
if (!config_dir || !config_dir[0])
{
g_get_any_init ();
if (g_home_dir)
config_dir = g_build_filename (g_home_dir, ".config", NULL);
if (g_get_home_dir ())
config_dir = g_build_filename (g_get_home_dir (), ".config", NULL);
else
config_dir = g_build_filename (g_get_tmp_dir (), g_user_name, ".config", NULL);
config_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".config", NULL);
}
g_user_config_dir = config_dir;
@@ -1327,12 +1322,10 @@ g_get_user_cache_dir (void)
#endif
if (!cache_dir || !cache_dir[0])
{
g_get_any_init ();
if (g_home_dir)
cache_dir = g_build_filename (g_home_dir, ".cache", NULL);
if (g_get_home_dir ())
cache_dir = g_build_filename (g_get_home_dir (), ".cache", NULL);
else
cache_dir = g_build_filename (g_get_tmp_dir (), g_user_name, ".cache", NULL);
cache_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".cache", NULL);
}
g_user_cache_dir = cache_dir;
}
@@ -1662,8 +1655,7 @@ load_user_special_dirs (void)
if (is_relative)
{
g_get_any_init ();
g_user_special_dirs[directory] = g_build_filename (g_home_dir, d, NULL);
g_user_special_dirs[directory] = g_build_filename (g_get_home_dir (), d, NULL);
}
else
g_user_special_dirs[directory] = g_strdup (d);
@@ -1769,12 +1761,7 @@ g_get_user_special_dir (GUserDirectory directory)
/* Special-case desktop for historical compatibility */
if (g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] == NULL)
{
g_get_any_init ();
g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] =
g_build_filename (g_home_dir, "Desktop", NULL);
}
g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = g_build_filename (g_get_home_dir (), "Desktop", NULL);
}
G_UNLOCK (g_utils_global);