aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-06-25 19:28:12 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-06-26 02:11:12 +0200
commit49ee551b9bff0bace277e416a4c4e2d1cd445036 (patch)
treeccd68f196f6b8b1b18f3454a76b6d611d1168e1b
parent089c90004ba8f2af9574e3982b20a4b6cb2ab2f1 (diff)
downloadfiv-49ee551b9bff0bace277e416a4c4e2d1cd445036.tar.gz
fiv-49ee551b9bff0bace277e416a4c4e2d1cd445036.tar.xz
fiv-49ee551b9bff0bace277e416a4c4e2d1cd445036.zip
Use LocalAppData for thumbnails on Windows
-rw-r--r--fiv-thumbnail.c9
1 files changed, 9 insertions, 0 deletions
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;