[meld] Don't try to open non-existent paths from directory comparison



commit c5ded035b5dd9b8344876e6f471cb619bf588bd7
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jun 2 06:51:17 2012 +1000

    Don't try to open non-existent paths from directory comparison
    
    The "Open externally" command always tried to open file paths gathered
    from the model, regardless of whether any paths were gathered. This led
    to attempts to open None in cases where the tree contained errors or
    missing files. This commit fixes this by first sanitising the list of
    files to be opened.

 meld/dirdiff.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 2f8fc97..d62552f 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -841,9 +841,12 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
 
     def open_external(self):
         pane = self._get_focused_pane()
-        if pane is not None:
-            m = self.model
-            files = [ m.value_path( m.get_iter(p), pane ) for p in self._get_selected_paths(pane) ]
+        if pane is None:
+            return
+        path = lambda p: self.model.value_path(self.model.get_iter(p), pane)
+        files = [path(p) for p in self._get_selected_paths(pane)]
+        files = [f for f in files if f]
+        if files:
             self._open_files(files)
 
     def on_button_ignore_case_toggled(self, button):



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