summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoki Fukuda <ko.fu.dev@gmail.com>2020-11-25 00:53:54 +0900
committerKoki Fukuda <ko.fu.dev@gmail.com>2020-11-25 01:03:23 +0900
commita69f5eefb4855218f87262fd44de96903f7ca508 (patch)
tree688373536c5ba6e301b8f0ebeff08bfd8eecc743
parentb466201c34f6da5dbdf9b859a574c45597ed2882 (diff)
downloadgnome-screenshot-a69f5eefb4855218f87262fd44de96903f7ca508.tar.gz
backend-shell: Use /tmp to save temporary file
It is likely that /tmp uses tmpfs, in-memory filesystem. So, save temporary file generated by shell to directory in /tmp to reduce disk access.
-rw-r--r--src/screenshot-backend-shell.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/screenshot-backend-shell.c b/src/screenshot-backend-shell.c
index 84c5ead..9c686d1 100644
--- a/src/screenshot-backend-shell.c
+++ b/src/screenshot-backend-shell.c
@@ -42,13 +42,14 @@ screenshot_backend_shell_get_pixbuf (ScreenshotBackend *backend,
GdkRectangle *rectangle)
{
g_autoptr(GError) error = NULL;
- g_autofree gchar *path = NULL, *filename = NULL, *tmpname = NULL;
+ g_autofree gchar *tmp_dirname = NULL, *path = NULL, *filename = NULL, *tmpname = NULL;
GdkPixbuf *screenshot = NULL;
const gchar *method_name;
GVariant *method_params;
GDBusConnection *connection;
- path = g_build_filename (g_get_user_cache_dir (), "gnome-screenshot", NULL);
+ tmp_dirname = g_strdup_printf ("gnome-screenshot-%s", g_get_user_name ());
+ path = g_build_filename (g_get_tmp_dir (), tmp_dirname, NULL);
g_mkdir_with_parents (path, 0700);
tmpname = g_strdup_printf ("scr-%d.png", g_random_int ());