nmcli: Move .nmcli-history

from its previous location unter the users `$HOME` directory to
`$XDG_CACHE_HOME/nmcli-history`. This makes `nmcli` compliant with the
[XDG Base Directory Specification][1].

[1]: https://specifications.freedesktop.org/basedir-spec/latest/
This commit is contained in:
Andreas Hartmann 2024-09-12 18:28:28 +00:00 committed by Íñigo Huguet
parent a2abc85504
commit 66e21700ea

View file

@ -6913,7 +6913,7 @@ nmcli_editor_tab_completion(const char *text, int start, int end)
return match_array;
}
#define NMCLI_EDITOR_HISTORY ".nmcli-history"
#define NMCLI_EDITOR_HISTORY "nmcli-history"
static void
load_history_cmds(const char *uuid)
@ -6925,7 +6925,7 @@ load_history_cmds(const char *uuid)
size_t i;
GError *err = NULL;
filename = g_build_filename(g_get_home_dir(), NMCLI_EDITOR_HISTORY, NULL);
filename = g_build_filename(g_get_user_cache_dir(), NMCLI_EDITOR_HISTORY, NULL);
kf = g_key_file_new();
if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &err)) {
if (g_error_matches(err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE))
@ -6961,7 +6961,7 @@ save_history_cmds(const char *uuid)
if (!hist)
return;
filename = g_build_filename(g_get_home_dir(), NMCLI_EDITOR_HISTORY, NULL);
filename = g_build_filename(g_get_user_cache_dir(), NMCLI_EDITOR_HISTORY, NULL);
kf = g_key_file_new();