mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-27 12:42:10 +01:00
gutils: Drop fallback handling for NULL homedirs in XDG getters
It’s not possible for g_build_home_dir() to return NULL. The fallback code here seems to originate from commit 1607e3f1 in 2005 (bug 169348), where it was added with the explanation “Guard against g_home_dir being NULL”. The XDG Base Directory specification doesn’t have anything to say about what to do when $HOME is unset: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html It’s all a bit moot, though, becaause since commit 9cbfb560 (bug 773435), g_{get,build}_home_dir() cannot return NULL. So just drop the fallback. See discussion on https://gitlab.gnome.org/GNOME/glib/merge_requests/505#note_386109. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
1947834b70
commit
7a79984068
@ -1292,12 +1292,7 @@ g_build_user_data_dir (void)
|
||||
if (!data_dir || !data_dir[0])
|
||||
{
|
||||
gchar *home_dir = g_build_home_dir ();
|
||||
|
||||
if (home_dir != NULL)
|
||||
data_dir = g_build_filename (home_dir, ".local", "share", NULL);
|
||||
else
|
||||
data_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".local", "share", NULL);
|
||||
|
||||
data_dir = g_build_filename (home_dir, ".local", "share", NULL);
|
||||
g_free (home_dir);
|
||||
}
|
||||
|
||||
@ -1357,12 +1352,7 @@ g_build_user_config_dir (void)
|
||||
if (!config_dir || !config_dir[0])
|
||||
{
|
||||
gchar *home_dir = g_build_home_dir ();
|
||||
|
||||
if (home_dir != NULL)
|
||||
config_dir = g_build_filename (home_dir, ".config", NULL);
|
||||
else
|
||||
config_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".config", NULL);
|
||||
|
||||
config_dir = g_build_filename (home_dir, ".config", NULL);
|
||||
g_free (home_dir);
|
||||
}
|
||||
|
||||
@ -1422,12 +1412,7 @@ g_build_user_cache_dir (void)
|
||||
if (!cache_dir || !cache_dir[0])
|
||||
{
|
||||
gchar *home_dir = g_build_home_dir ();
|
||||
|
||||
if (home_dir != NULL)
|
||||
cache_dir = g_build_filename (home_dir, ".cache", NULL);
|
||||
else
|
||||
cache_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".cache", NULL);
|
||||
|
||||
cache_dir = g_build_filename (home_dir, ".cache", NULL);
|
||||
g_free (home_dir);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user