GNOME Bugzilla – Bug 599682
Use XDG cache directory instead of ~/.evolution/cache
Last modified: 2010-07-27 17:05:54 UTC
The summary says it all. Evolution (at least 2.28.x) uses a non-standard directory when opening attachments in external viewers, e.g. when opening a PDF attachment in Evince.
Confirming. Cache directory would be a good place to start moving toward XDG compliance, since the data would not have to be migrated.
Created attachment 158456 [details] [review] 0001-Use-XDG-cache-directory-instead-of-.evolution-cache.patch Hi. It looked quite trivial and I did a patch. Tell me if it's not enough
+ tmpdir = g_build_filename(g_get_user_cache_dir (), + "evolution", "tmp", NULL); path = g_string_new(tmpdir); if (make && g_mkdir_with_parents(tmpdir, 0777) == -1) { Since this may create the toplevel g_get_user_cache_dir() too, you must use 0700 permissions here to comply with the spec. Also should check errno == EEXIST on return of -1 since that's not a failure. That said, this does look wrong. If it's a temp directly to store temp files while they're opened in external programmes, it's not a *cache* and should use g_get_tmp_dir() instead. This code is in a #ifdef TEMP_HOME (which default to defined) so it's supposed to create a temp file not in /tmp but if that's really important the user can just set TMPDIR which g_get_tmp_dir() will honour.
So, as far as I have understood, the correct way to do this would be removing the TEMP_HOME constant and using just g_get_tmp_dir(), right? And then creating the tmp dir (checking properly the return values). I also found in devhelp a function called "g_file_error_from_errno ()". Should I use it instead?
mbarnes is working on the same and would be the right person to review this patch.
Evolution 2.31.6 will be fully compliant with XDG base directories -- not just cache but also data and config directories. This was implemented in several commits spanning all Evolution-related modules. I won't try to link to them all from here, but the commits were made over the course of this mailing list thread: http://mail.gnome.org/archives/evolution-hackers/2010-June/msg00000.html