Fixed some pathlib related issues. eric7-maintenance

Sun, 03 Jul 2022 18:09:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 03 Jul 2022 18:09:29 +0200
branch
eric7-maintenance
changeset 9241
d23e9854aea4
parent 9200
709ff2ffed4d
child 9264
18a7312cfdb3

Fixed some pathlib related issues.
(grafted from b201a2ffe174da2209ae597fa5149601d6a4ea6a)

eric7/QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/eric7/QScintilla/Editor.py	Sat Jul 02 17:22:06 2022 +0200
+++ b/eric7/QScintilla/Editor.py	Sun Jul 03 18:09:29 2022 +0200
@@ -1970,7 +1970,7 @@
         
         @param m modification status
         """
-        if not m and bool(self.fileName):
+        if not m and bool(self.fileName) and pathlib.Path(self.fileName).exists():
             self.lastModified = pathlib.Path(self.fileName).stat().st_mtime
         self.modificationStatusChanged.emit(m, self)
         self.undoAvailable.emit(self.isUndoAvailable())
@@ -3496,7 +3496,11 @@
             self.__checkEncoding()
             return True
         else:
-            self.lastModified = pathlib.Path(fn).stat().st_mtime
+            self.lastModified = (
+                pathlib.Path(fn).stat().st_mtime
+                if pathlib.Path(fn).exists() else
+                0
+            )
             return False
         
     def saveFileAs(self, path=None, toProject=False):
@@ -7086,6 +7090,7 @@
         if (
             self.vm.editorsCheckFocusInEnabled() and
             not self.inReopenPrompt and self.fileName and
+            pathlib.Path(self.fileName).exists() and
             pathlib.Path(self.fileName).stat().st_mtime != self.lastModified
         ):
             self.inReopenPrompt = True

eric ide

mercurial