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




commit be4491b23606a4915bed7627ed960eecaa5623d2
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, 5 insertions(+), 1 deletion(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index 52f158e..81df07f 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1819,7 +1819,11 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
                                                 files,
                                                 &new_destination);
 
-    self->new_prefix = new_destination;
+    if (new_destination && !g_file_equal (self->prefix, new_destination)) {
+      self->new_prefix = new_destination;
+    } else {
+      g_clear_object (&new_destination);
+    }
   } else {
     autoar_extractor_signal_decide_destination (self,
                                                 self->destination_dir,


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