Hi.

Sorry for the spam jamiemcc, I didnt realize that the messages got sent
only to you and not the list.

The attached patch should solve the bug in question.  Please test it,
and let me know.

Thanks.

Saleem Abdulrasool
compnerd (at) gentoo (dot) org
Index: src/tracker-thumbnailer/tracker-thumbnailer.c
===================================================================
--- src/tracker-thumbnailer/tracker-thumbnailer.c       (revision 373)
+++ src/tracker-thumbnailer/tracker-thumbnailer.c       (working copy)
@@ -33,6 +33,34 @@
 #define LIBDIR "/usr/lib"
 #endif
 
+guint
+create_thumbnails_dir(const gchar * const subdir)
+{
+       gchar *thumbnails_dir = NULL;
+       thumbnails_dir = g_build_filename(g_get_home_dir(), ".thumbnails", 
NULL);
+
+       /* Ensure that ~/.thumbnails is not a file if it exists */
+       if (g_file_test(thumbnails_dir, G_FILE_TEST_EXISTS) &&
+                       !g_file_test(thumbnails_dir, G_FILE_TEST_IS_DIR)) {
+               g_printerr("%s exists but is not a directory.\n", 
thumbnails_dir);
+               goto error;
+       }
+
+       g_free(thumbnails_dir);
+       thumbnails_dir = g_build_filename(g_get_home_dir(), ".thumbnails", 
subdir, NULL);
+       if (g_mkdir_with_parents(thumbnails_dir, 00775) == -1) {
+               g_printerr("failed: g_mkdir_with_parents(%s)\n", 
thumbnails_dir);
+               goto error;
+       }
+
+       g_free(thumbnails_dir);
+       return 0;
+
+error:
+       g_free(thumbnails_dir);
+       return -1;
+}
+
 /* argv[1] == full path of file to be nailed
  * argv[2] == mime type of said file
  * argv[3] == requested size: "normal", "large", "preview"
@@ -69,6 +97,9 @@
                return EXIT_FAILURE;
        }
 
+       if (create_thumbnails_dir(argv[3]) != 0)
+               return EXIT_FAILURE;
+
        /* make sure the actual file exists */
        if (!g_file_test (argv[1], G_FILE_TEST_EXISTS)) {
                g_printerr ("%s does not exist\n", argv[1]);

Attachment: pgp5ZTaZjlV1y.pgp
Description: PGP signature

_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list

Reply via email to