From 49ee551b9bff0bace277e416a4c4e2d1cd445036 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sun, 25 Jun 2023 19:28:12 +0200 Subject: Use LocalAppData for thumbnails on Windows --- fiv-thumbnail.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fiv-thumbnail.c b/fiv-thumbnail.c index 26d21f1..92f6ca7 100644 --- a/fiv-thumbnail.c +++ b/fiv-thumbnail.c @@ -100,7 +100,16 @@ mark_thumbnail_lq(cairo_surface_t *surface) static gchar * fiv_thumbnail_get_root(void) { +#ifdef G_OS_WIN32 + // We can do better than GLib with FOLDERID_InternetCache, + // and we don't want to place .cache directly in the user's home. + // TODO(p): Register this thumbnail path using the installer: + // https://learn.microsoft.com/en-us/windows/win32/lwef/disk-cleanup + gchar *cache_dir = + g_build_filename(g_get_user_data_dir(), PROJECT_NAME, NULL); +#else gchar *cache_dir = get_xdg_home_dir("XDG_CACHE_HOME", ".cache"); +#endif gchar *thumbnails_dir = g_build_filename(cache_dir, "thumbnails", NULL); g_free(cache_dir); return thumbnails_dir; -- cgit v1.2.3-70-g09d2