[gnome-autoar/wip/oholy/extractor-one-file-same-name-fix: 2/4] extractor: Prevent redundant path name handling for equal prefixes




commit c8ef5ef621417fcee78f9ffc0f39e29ef23e2bf5
Author: Ondrej Holy <oholy redhat com>
Date:   Mon May 10 15:01:54 2021 +0200

    extractor: Prevent redundant path name handling for equal prefixes
    
    Currently, redundant path name handling happens when archive files have
    a common prefix and an equal destination is returned from the `decide-destination`
    signal. In this case, the old prefix is removed and the new one (the equal one)
    is added again. Let's detect this case and prevent the redundancy.

 gnome-autoar/autoar-extractor.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index 0f4ad57..21b0e30 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1817,9 +1817,11 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
     autoar_extractor_signal_decide_destination (self,
                                                 self->prefix,
                                                 files,
-                                                &new_destination);
+                                                &self->new_prefix);
 
-    self->new_prefix = new_destination;
+    if (self->new_prefix && g_file_equal (self->prefix, self->new_prefix)) {
+      g_clear_object (&self->new_prefix);
+    }
   } else {
     autoar_extractor_signal_decide_destination (self,
                                                 self->destination_dir,


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