Fixed some pathlib related issues. eric7

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
changeset 9203
b201a2ffe174
parent 9202
81388c6065e8
child 9204
be84ff69f30e

Fixed some pathlib related issues.

eric7/QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/eric7/QScintilla/Editor.py	Sun Jul 03 13:52:59 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