GNOME Bugzilla – Bug 634666
Function to return the thumbnail directory would be useful
Last modified: 2018-05-24 12:53:21 UTC
The GIMP stores thumbnails into the .thumbnails folder in the user's home folder on Windows. This is not where applications should store files on Windows, and can get messy. Instead, applications on Windows should store data into the AppData folder provided. This prevents personal files from getting mixed with other data. I ask that an #ifdef WIN32 is added and makes GIMP use the Appdata folder to save configuration and thumbnail files.
This is not something for GIMP to fix. This is supposed to be a desktop-wide thing, and even on windows also used by e.g. GTK+. The thumnail spec apparently hasn't changed in a long time, so i'm going to reassign this to the lowest component in the stack, which is GIO which also does thumbnail handling and could provide a function like g_get_thumbnail_dir() to abstract this away.
You can always set the HOME environment variable. On Windows, g_get_home_dir() checks that first, and uses it if set. And GIMP uses the .thumbnails folder in wherever g_get_home_dir() returns.
The thumbnailing spec operates in a very specific way and its scope is limited to freedesktop unix systems. The possibility of applying the spec on windows isn't even mentioned. Knowing the correct directory to use for this is a very small part of implementing the spec. Thumbnail data that does not adhere to the spec should not be stored in this directory. Similarly, I wouldn't expect that it's useful to store thumbnails in the (spec-)specified format outside of the usual place (which is XDG_CACHE_HOME/thumbnails). In short, either: implement the thumbnail spec yourself (of which concatenating "thumbnails" to the return value of g_get_user_cache_dir() is only a tiny aspect) or use a different directory -- and that's up to you. In general, g_get_user_cache_dir() will return something meaningful on all platforms -- just create a path based on that. If you're not using the thumbnail spec, then please try to avoid using the same dir -- maybe put "gimp" in the name. I'm not closing this because the bug still exists -- but it's a GIMP issue.
GIMP does adhere to the thumbnail spec, but it's pretty clear that we can't put the files into either ~/.thumnails or XDG_CACHE_HOME/thumbnails on both windows nor OS X. I have not much clue about windows, but at least on OS X which is reasonably non-brain-damaged, we made up our own "standard" and made the thumbnail root directory ~/Library/Caches/org.freedesktop.thumbnails/ and follow the spec inside that dir. XDG is simply not cross-platform, and I would prefer if not every app had to make that decision by itself, or is this really what you expect to happen?
I'm happy for GIMP to choose... I certainly don't want to get into the business of picking paths like "~/Library/Caches/org.freedesktop.thumbnails" on Mac OS. As far as GLib is concerned, Mac OS is a UNIX system like any other...
That may be so, but an application that wants to behave natively on OS X and come in a proper app bundle would also want GIO to pick the thumnails from the right location, not only its own thumbnail logic. This needs support from GLib. You can only say "not GLib's problem" as long as GLib doesn't behave in a clearly wrong way on the platform :)
(In reply to comment #6) > You can only say "not GLib's problem" as long as GLib > doesn't behave in a clearly wrong way on the platform :) No. As far as GLib is concerned, Mac OS is UNIX. It would be wrong for us to assume otherwise, and probably contrary to user expectation. Graphical applications shipped in app bundles are another story, and this is an old conversation: providing a means to override certain "standard" directories, at runtime, if explicitly instructed to do say, may be interesting. This is a much larger problem though. Certainly before that point (and maybe even after it) it doesn't make sense to talk about this proposal.
I can set all XDG variables from GIMP in one small early-called function, and then use unchanged code on all platforms. I can NOT do this for the thumbnail directory. I can not change it, and GIO will always use a hardcoded subdirectory of CACHE, no matter of this is the right choice for the platform. I'm only asking for a way to configure it, and get to the folder via standard API, not for GLib to do it on my behalf.
It sounds like you rather want a function to _set_ the thumbnail path then, not get it... What's wrong with just pointing XDG_CACHE_HOME at Library/Cache?
Because that would result in Library/Caches/thumbnails but whose thumbnails. Following the example of other software, it should probably be Library/Caches/org.freedesktop.thumbnails So to do it properly, we'de need API to both set and get it.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/348.