diff options
author | Koki Fukuda <ko.fu.dev@gmail.com> | 2020-11-25 00:53:54 +0900 |
---|---|---|
committer | Koki Fukuda <ko.fu.dev@gmail.com> | 2020-11-25 01:03:23 +0900 |
commit | a69f5eefb4855218f87262fd44de96903f7ca508 (patch) | |
tree | 688373536c5ba6e301b8f0ebeff08bfd8eecc743 /src/screenshot-backend-shell.c | |
parent | b466201c34f6da5dbdf9b859a574c45597ed2882 (diff) | |
download | gnome-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.
Diffstat (limited to 'src/screenshot-backend-shell.c')
-rw-r--r-- | src/screenshot-backend-shell.c | 5 |
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 ()); |