Fixed issues with reopening a project where files were delete while they were opened in an editor. 5_4_x

Sat, 08 Feb 2014 20:09:58 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 08 Feb 2014 20:09:58 +0100
branch
5_4_x
changeset 3262
fffe2df45766
parent 3258
a2bec950a859
child 3263
8b1de95c43db

Fixed issues with reopening a project where files were delete while they were opened in an editor.
(grafted from b8fee972444be5d4bafaa26d99e0c71b4d0cfc56)

QScintilla/Editor.py file | annotate | diff | comparison | revisions
ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
--- a/QScintilla/Editor.py	Sat Feb 01 18:41:02 2014 +0100
+++ b/QScintilla/Editor.py	Sat Feb 08 20:09:58 2014 +0100
@@ -6146,6 +6146,11 @@
             self.markerDeleteHandle(handle)
         self.breaks = {}
         
+        if not os.path.exists(self.fileName):
+            # close the file, if it was deleted in the background
+            self.close()
+            return
+        
         # reread the file
         try:
             self.readFile(self.fileName)
--- a/ViewManager/ViewManager.py	Sat Feb 01 18:41:02 2014 +0100
+++ b/ViewManager/ViewManager.py	Sat Feb 08 20:09:58 2014 +0100
@@ -4543,7 +4543,8 @@
         filenames = []
         for editor in self.editors:
             fn = editor.getFileName()
-            if fn is not None and fn not in filenames:
+            if fn is not None and fn not in filenames and os.path.exists(fn):
+                # only return names of existing files
                 filenames.append(fn)
         
         return filenames

eric ide

mercurial