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




commit b9590ab77b70e74e9deffd2af6c32908dc3c5aaf
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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index 25f9816..c4279b3 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1817,9 +1817,12 @@ 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)) {
+      /* This prevents redundant path name handling later. */
+      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]