[rhythmbox] import-job: resolve symlinks before adding to the import job



commit 6c35133bf91b87f198c160f4bc5603a74dbd9741
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat May 24 16:38:26 2014 +1000

    import-job: resolve symlinks before adding to the import job
    
    RhythmDB resolves symlinks internally, so files will appear under the
    canonical location rather than what we get from the uri recurser.
    If we add the non-canonical location to the import job, the job will never
    finish.

 rhythmdb/rhythmdb-import-job.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/rhythmdb/rhythmdb-import-job.c b/rhythmdb/rhythmdb-import-job.c
index e26fc68..41746ab 100644
--- a/rhythmdb/rhythmdb-import-job.c
+++ b/rhythmdb/rhythmdb-import-job.c
@@ -326,7 +326,18 @@ uri_recurse_func (GFile *file, GFileInfo *info, RhythmDBImportJob *job)
        if (g_cancellable_is_cancelled (job->priv->cancel))
                return FALSE;
 
-       uri = g_file_get_uri (file);
+       if (g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK)) {
+               GFile *r;
+               r = rb_file_resolve_symlink (file, NULL);
+               if (r != NULL) {
+                       uri = g_file_get_uri (r);
+                       g_object_unref (r);
+               } else {
+                       return FALSE;
+               }
+       } else {
+               uri = g_file_get_uri (file);
+       }
 
        /* if it's not already in the db, add it to the list of things to process */
        entry = rhythmdb_entry_lookup_by_location (job->priv->db, uri);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]