From 59d520af8bbb6ff7702575036be387a9875b440d Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Wed, 1 Dec 2010 16:09:29 +0100 Subject: Stop putting files in /tmp Whether the wallpaper or the icons themselves, save them in $XDG_CACHE_DIR, and simplify saving. --- src/sbitem.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/sbitem.c') diff --git a/src/sbitem.c b/src/sbitem.c index b49a98f..9b49186 100644 --- a/src/sbitem.c +++ b/src/sbitem.c @@ -117,9 +117,28 @@ void g_func_sbitem_free(SBItem *item, gpointer data) char *sbitem_get_icon_filename(SBItem *item) { - char *value = sbitem_get_display_identifier(item); + static gboolean create_dir = FALSE; + const char *value; + char *filename, *path; + + if (create_dir == FALSE) { + path = g_build_filename (g_get_user_cache_dir (), + "libimobiledevice", + "icons", NULL); + if (g_mkdir_with_parents (path, 0755) >= 0) + create_dir = TRUE; + g_free (path); + } + + value = sbitem_get_display_identifier(item); if (!value) return NULL; - return g_strdup_printf("/tmp/%s.png", value); + filename = g_strdup_printf ("%s.png", value); + path = g_build_filename (g_get_user_cache_dir (), + "libimobiledevice", + "icons", + filename, NULL); + g_free (filename); + return path; } -- cgit v1.1-32-gdbae