[gnome-desktop] thumbnailer: Cleanup stale thumbnail directories
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] thumbnailer: Cleanup stale thumbnail directories
- Date: Wed, 15 May 2019 17:26:13 +0000 (UTC)
commit 03778dbd82653e687d8701bade56284f77c5ebd4
Author: daniel <daniel mohns posteo de>
Date: Wed May 15 19:15:37 2019 +0200
thumbnailer: Cleanup stale thumbnail directories
To correctly cleanup after thumbnail generation for inode/directory
objects we need to distinguish between files and directories. Then
cleanup with `g_rmdir` or `g_unlink` accordingly.
Also, we add a consistency condition when naming the temporary files, as
directories will be extention-less.
libgnome-desktop/gnome-desktop-thumbnail-script.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail-script.c
b/libgnome-desktop/gnome-desktop-thumbnail-script.c
index 79419760..0aa26444 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail-script.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail-script.c
@@ -719,7 +719,10 @@ script_exec_free (ScriptExec *exec)
g_free (exec->infile);
if (exec->infile_tmp)
{
- g_unlink (exec->infile_tmp);
+ if (g_file_test (exec->infile_tmp, G_FILE_TEST_IS_DIR))
+ g_rmdir (exec->infile_tmp);
+ else
+ g_unlink (exec->infile_tmp);
g_free (exec->infile_tmp);
}
if (exec->outfile)
@@ -797,7 +800,12 @@ script_exec_new (const char *uri,
}
exec->outfile = g_build_filename (exec->outdir, "gnome-desktop-thumbnailer.png", NULL);
ext = get_extension (exec->infile);
- infile = g_strdup_printf ("gnome-desktop-file-to-thumbnail.%s", ext);
+
+ if (ext)
+ infile = g_strdup_printf ("gnome-desktop-file-to-thumbnail.%s", ext);
+ else
+ infile = g_strdup_printf ("gnome-desktop-file-to-thumbnail");
+
exec->infile_tmp = g_build_filename (exec->outdir, infile, NULL);
exec->s_infile = g_build_filename ("/tmp/", infile, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]