File gummi-predictable-tmpfiles.patch of Package gummi
From 4ad6486dd282b32dfe06f30d9ee3cd2208a1386c Mon Sep 17 00:00:00 2001
From: Alexander van der Meij <alexandervdm@gliese.me>
Date: Wed, 27 Jan 2016 12:57:03 +0100
Subject: [PATCH] use XDG cache dir for tmp files rather than TMPDIR
---
src/constants.h | 2 +-
src/editor.c | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
Index: gummi-gtk3-0.7.1/src/constants.h
===================================================================
--- gummi-gtk3-0.7.1.orig/src/constants.h
+++ gummi-gtk3-0.7.1/src/constants.h
@@ -54,7 +54,7 @@
/* Platform dependant constants : */
-#define C_TMPDIR utils_get_tmp_tmp_dir()
+#define C_TMPDIR g_build_path(G_DIR_SEPARATOR_S, g_get_user_cache_dir(), "gummi", NULL)
#ifdef WIN32
#define C_CMDSEP "&&"
Index: gummi-gtk3-0.7.1/src/editor.c
===================================================================
--- gummi-gtk3-0.7.1.orig/src/editor.c
+++ gummi-gtk3-0.7.1/src/editor.c
@@ -173,21 +173,27 @@ static void on_delete_range(GtkTextBuffe
* Since pdflatex refuses to compile TeX files with '.' prefixed, we have to
* set the environment variable 'openout_any=a'.
*
- * For a newly created document, all files including the TeX file is stored
- * under the temp directory. For files that are already saved, only the
- * workfile is saved under DIRNAME (FILENAME). Other compilation-related files
- * are located in the temp directory.
+ * For a newly created document, all files including the TeX file are stored
+ * under the ~/.cache folder (freedesktop XDG standard). For files that are
+ * already saved, only the workfile is saved under DIRNAME (FILENAME).
+ * Other compilation-related files are located in the temp directory.
*
* P.S. pdflatex will automatically strip the suffix, so for a file named
* FILE.tex under /absolute/path/:
*
* filename = /absolute/path/FILE.tex
* workfile = /absolute/path/.FILE.tex.swp
- * pdffile = /tmp/.FILE.tex.pdf
+ * pdffile = ~/cache/gummi/.FILE.tex.pdf
*/
void editor_fileinfo_update(GuEditor* ec, const gchar* filename)
{
+ // directory should exist, but if not create ~/.cache/gummi:
+ if (!g_file_test (C_TMPDIR, G_FILE_TEST_IS_DIR)) {
+ slog (L_WARNING, ".cache directory does not exist, creating..\n");
+ g_mkdir_with_parents (C_TMPDIR, DIR_PERMS);
+ }
+
if (ec->workfd != -1)
editor_fileinfo_cleanup(ec);