Finished replacing the use of "QFileInfo()" with Python equivalents. eric7

Fri, 17 Jun 2022 16:36:14 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 17 Jun 2022 16:36:14 +0200
branch
eric7
changeset 9153
506e35e424d5
parent 9152
8a68afaf1ba2
child 9154
e8ca7b41a7d8

Finished replacing the use of "QFileInfo()" with Python equivalents.

eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
eric7/Cooperation/ChatWidget.py file | annotate | diff | comparison | revisions
eric7/Debugger/CallStackViewer.py file | annotate | diff | comparison | revisions
eric7/Debugger/CallTraceViewer.py file | annotate | diff | comparison | revisions
eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric7/Documentation/Source/eric7.EricNetwork.EricSslCertificatesDialog.html file | annotate | diff | comparison | revisions
eric7/Documentation/Source/eric7.EricWidgets.EricPathPicker.html file | annotate | diff | comparison | revisions
eric7/Documentation/Source/eric7.WebBrowser.Session.SessionManager.html file | annotate | diff | comparison | revisions
eric7/EricNetwork/EricSslCertificatesDialog.py file | annotate | diff | comparison | revisions
eric7/Graphics/UMLDialog.py file | annotate | diff | comparison | revisions
eric7/Graphics/UMLGraphicsView.py file | annotate | diff | comparison | revisions
eric7/HexEdit/HexEditMainWindow.py file | annotate | diff | comparison | revisions
eric7/IconEditor/IconEditorWindow.py file | annotate | diff | comparison | revisions
eric7/Network/IRC/IrcChannelWidget.py file | annotate | diff | comparison | revisions
eric7/Network/IRC/IrcNetworkWidget.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsGit/ProjectHelper.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsGit/git.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py file | annotate | diff | comparison | revisions
eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py file | annotate | diff | comparison | revisions
eric7/Project/Project.py file | annotate | diff | comparison | revisions
eric7/Project/ProjectFormsBrowser.py file | annotate | diff | comparison | revisions
eric7/Project/ProjectResourcesBrowser.py file | annotate | diff | comparison | revisions
eric7/QScintilla/Editor.py file | annotate | diff | comparison | revisions
eric7/QScintilla/Exporters/ExporterBase.py file | annotate | diff | comparison | revisions
eric7/QScintilla/Shell.py file | annotate | diff | comparison | revisions
eric7/Templates/TemplateViewer.py file | annotate | diff | comparison | revisions
eric7/Tools/UIPreviewer.py file | annotate | diff | comparison | revisions
eric7/UI/DiffDialog.py file | annotate | diff | comparison | revisions
eric7/UI/UserInterface.py file | annotate | diff | comparison | revisions
eric7/VCS/ProjectHelper.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Bookmarks/BookmarksManager.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Download/DownloadItem.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/History/HistoryManager.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/PageScreenDialog.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/QtHelp/HelpDocsInstaller.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Session/SessionManager.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Session/SessionManagerDialog.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Sync/DirectorySyncHandler.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/Sync/FtpSyncHandler.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/WebBrowserView.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/WebBrowserWindow.py file | annotate | diff | comparison | revisions
--- a/eric7/APIs/Python3/eric7.api	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/APIs/Python3/eric7.api	Fri Jun 17 16:36:14 2022 +0200
@@ -1487,7 +1487,7 @@
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase._editorText?5()
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase._setEditorText?5(text)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.aboutToShowPathPickerDialog?7
-eric7.EricWidgets.EricPathPicker.EricPathPickerBase.addItem?4(path)
+eric7.EricWidgets.EricPathPicker.EricPathPickerBase.addItem?4(fpath)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.addItems?4(pathsList)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.buttonToolTip?4()
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.clear?4()
@@ -1511,19 +1511,19 @@
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setCurrentIndex?4(index)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setCurrentText?4(text)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setDefaultDirectory?4(directory)
-eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setEditText?4(path, toNative=True)
+eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setEditText?4(fpath, toNative=True)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setEditorEnabled?4(enable)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setEditorToolTip?4(tooltip)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setFilters?4(filters)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setInsertPolicy?4(policy)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setMode?4(mode)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setNameFilters?4(filters)
-eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setPath?4(path, toNative=True)
+eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setPath?4(fpath, toNative=True)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setPathsList?4(pathsList)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setPickerEnabled?4(enable)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setReadOnly?4(readOnly)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setSizeAdjustPolicy?4(policy)
-eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setText?4(path, toNative=True)
+eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setText?4(fpath, toNative=True)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.setWindowTitle?4(title)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.text?4(toNative=True)
 eric7.EricWidgets.EricPathPicker.EricPathPickerBase.textChanged?7
--- a/eric7/Cooperation/ChatWidget.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Cooperation/ChatWidget.py	Fri Jun 17 16:36:14 2022 +0200
@@ -569,7 +569,7 @@
                         self,
                         self.tr("Save Chat"),
                         self.tr("<p>The file <b>{0}</b> already exists."
-                                " Overwrite it?</p>").format(str(fpath)),
+                                " Overwrite it?</p>").format(fpath),
                         icon=EricMessageBox.Warning)
                     if not res:
                         return
@@ -583,8 +583,8 @@
                         self.tr("Error saving Chat"),
                         self.tr("""<p>The chat contents could not be"""
                                 """ written to <b>{0}</b></p>"""
-                                """<p>Reason: {1}</p>""") .format(
-                            str(fpath), str(err)))
+                                """<p>Reason: {1}</p>""")
+                        .format(fpath, str(err)))
     
     def __copyChat(self):
         """
--- a/eric7/Debugger/CallStackViewer.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Debugger/CallStackViewer.py	Fri Jun 17 16:36:14 2022 +0200
@@ -206,7 +206,7 @@
                         self,
                         self.tr("Save Call Stack Info"),
                         self.tr("<p>The file <b>{0}</b> already exists."
-                                " Overwrite it?</p>").format(str(fpath)),
+                                " Overwrite it?</p>").format(fpath),
                         icon=EricMessageBox.Warning)
                     if not res:
                         return
@@ -229,4 +229,4 @@
                         self.tr("""<p>The call stack info could not be"""
                                 """ written to <b>{0}</b></p>"""
                                 """<p>Reason: {1}</p>""")
-                        .format(str(fpath), str(err)))
+                        .format(fpath, str(err)))
--- a/eric7/Debugger/CallTraceViewer.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Debugger/CallTraceViewer.py	Fri Jun 17 16:36:14 2022 +0200
@@ -170,7 +170,7 @@
                         self,
                         self.tr("Save Call Trace Info"),
                         self.tr("<p>The file <b>{0}</b> already exists."
-                                " Overwrite it?</p>").format(str(fpath)),
+                                " Overwrite it?</p>").format(fpath),
                         icon=EricMessageBox.Warning)
                     if not res:
                         return
@@ -196,7 +196,7 @@
                         self.tr("""<p>The call trace info could not"""
                                 """ be written to <b>{0}</b></p>"""
                                 """<p>Reason: {1}</p>""")
-                        .format(str(fpath), str(err)))
+                        .format(fpath, str(err)))
     
     @pyqtSlot(QTreeWidgetItem, int)
     def on_callTrace_itemDoubleClicked(self, item, column):
Binary file eric7/Documentation/Help/source.qch has changed
--- a/eric7/Documentation/Source/eric7.EricNetwork.EricSslCertificatesDialog.html	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Documentation/Source/eric7.EricNetwork.EricSslCertificatesDialog.html	Fri Jun 17 16:36:14 2022 +0200
@@ -192,13 +192,13 @@
 </p>
 <dl>
 
-<dt><i>name</i></dt>
+<dt><i>name</i> (str)</dt>
 <dd>
-default file name without extension (string)
+default file name without extension
 </dd>
-<dt><i>cert</i></dt>
+<dt><i>cert</i> (QByteArray)</dt>
 <dd>
-certificate to be exported (QSslCertificate)
+certificate to be exported encoded as PEM
 </dd>
 </dl>
 <a NAME="EricSslCertificatesDialog.__getSystemCaCertificates" ID="EricSslCertificatesDialog.__getSystemCaCertificates"></a>
@@ -224,7 +224,13 @@
 <dl>
 <dt>Return:</dt>
 <dd>
-certificates read (list of QSslCertificate)
+certificates read
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+list of QSslCertificate
 </dd>
 </dl>
 <a NAME="EricSslCertificatesDialog.__populateCaCertificatesTree" ID="EricSslCertificatesDialog.__populateCaCertificatesTree"></a>
--- a/eric7/Documentation/Source/eric7.EricWidgets.EricPathPicker.html	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Documentation/Source/eric7.EricWidgets.EricPathPicker.html	Fri Jun 17 16:36:14 2022 +0200
@@ -415,14 +415,14 @@
 </dl>
 <a NAME="EricPathPickerBase.__pathEdited" ID="EricPathPickerBase.__pathEdited"></a>
 <h4>EricPathPickerBase.__pathEdited</h4>
-<b>__pathEdited</b>(<i>path</i>)
+<b>__pathEdited</b>(<i>fpath</i>)
 
 <p>
         Private slot handling editing of the path.
 </p>
 <dl>
 
-<dt><i>path</i> (str)</dt>
+<dt><i>fpath</i> (str)</dt>
 <dd>
 current text of the path line edit
 </dd>
@@ -469,14 +469,14 @@
 </dl>
 <a NAME="EricPathPickerBase.addItem" ID="EricPathPickerBase.addItem"></a>
 <h4>EricPathPickerBase.addItem</h4>
-<b>addItem</b>(<i>path</i>)
+<b>addItem</b>(<i>fpath</i>)
 
 <p>
         Public method to add a paths to the current list.
 </p>
 <dl>
 
-<dt><i>path</i> (str)</dt>
+<dt><i>fpath</i> (str)</dt>
 <dd>
 path to add
 </dd>
@@ -854,14 +854,14 @@
 </dl>
 <a NAME="EricPathPickerBase.setEditText" ID="EricPathPickerBase.setEditText"></a>
 <h4>EricPathPickerBase.setEditText</h4>
-<b>setEditText</b>(<i>path, toNative=True</i>)
+<b>setEditText</b>(<i>fpath, toNative=True</i>)
 
 <p>
         Public method to set the current path.
 </p>
 <dl>
 
-<dt><i>path</i> (str)</dt>
+<dt><i>fpath</i> (str)</dt>
 <dd>
 path to be set
 </dd>
@@ -967,14 +967,14 @@
 </dl>
 <a NAME="EricPathPickerBase.setPath" ID="EricPathPickerBase.setPath"></a>
 <h4>EricPathPickerBase.setPath</h4>
-<b>setPath</b>(<i>path, toNative=True</i>)
+<b>setPath</b>(<i>fpath, toNative=True</i>)
 
 <p>
         Public method to set the current path.
 </p>
 <dl>
 
-<dt><i>path</i> (str)</dt>
+<dt><i>fpath</i> (str)</dt>
 <dd>
 path to be set
 </dd>
@@ -1042,14 +1042,14 @@
 </dl>
 <a NAME="EricPathPickerBase.setText" ID="EricPathPickerBase.setText"></a>
 <h4>EricPathPickerBase.setText</h4>
-<b>setText</b>(<i>path, toNative=True</i>)
+<b>setText</b>(<i>fpath, toNative=True</i>)
 
 <p>
         Public method to set the current path.
 </p>
 <dl>
 
-<dt><i>path</i> (str)</dt>
+<dt><i>fpath</i> (str)</dt>
 <dd>
 path to be set
 </dd>
--- a/eric7/Documentation/Source/eric7.WebBrowser.Session.SessionManager.html	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Documentation/Source/eric7.WebBrowser.Session.SessionManager.html	Fri Jun 17 16:36:14 2022 +0200
@@ -330,7 +330,7 @@
 </p>
 <dl>
 
-<dt><i>filePath</i> (str or QFileInfo)</dt>
+<dt><i>filePath</i> (str or pathlib.Path)</dt>
 <dd>
 path of the session file to be checked
 </dd>
--- a/eric7/EricNetwork/EricSslCertificatesDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/EricNetwork/EricSslCertificatesDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -480,7 +480,7 @@
                         self.tr(
                             """<p>The certificate could not be written"""
                             """ to file <b>{0}</b></p><p>Error: {1}</p>""")
-                        .format(str(fpath), str(err)))
+                        .format(fpath, str(err)))
     
     def __importCertificate(self):
         """
--- a/eric7/Graphics/UMLDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Graphics/UMLDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -261,7 +261,7 @@
                     self,
                     self.tr("Save Diagram"),
                     self.tr("<p>The file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(str(fpath)),
+                            " Overwrite it?</p>").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
--- a/eric7/Graphics/UMLGraphicsView.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Graphics/UMLGraphicsView.py	Fri Jun 17 16:36:14 2022 +0200
@@ -379,7 +379,7 @@
                     self,
                     self.tr("Save Diagram"),
                     self.tr("<p>The file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(str(fpath)),
+                            " Overwrite it?</p>").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
@@ -392,7 +392,7 @@
                     self.tr("Save Diagram"),
                     self.tr(
                         """<p>The file <b>{0}</b> could not be saved.</p>""")
-                    .format(str(fpath)))
+                    .format(fpath))
         
     def __relayout(self):
         """
--- a/eric7/HexEdit/HexEditMainWindow.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/HexEdit/HexEditMainWindow.py	Fri Jun 17 16:36:14 2022 +0200
@@ -1175,7 +1175,7 @@
                 self,
                 self.tr("Save to readable file"),
                 self.tr("<p>The file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -1192,7 +1192,7 @@
             EricMessageBox.warning(
                 self, self.tr("eric Hex Editor"),
                 self.tr("Cannot write file '{0}:\n{1}.")
-                .format(str(fpath), str(err)))
+                .format(fpath, str(err)))
             return
         
         self.__statusBar.showMessage(self.tr("File saved"), 2000)
--- a/eric7/IconEditor/IconEditorWindow.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/IconEditor/IconEditorWindow.py	Fri Jun 17 16:36:14 2022 +0200
@@ -1120,12 +1120,12 @@
                 self,
                 self.tr("Save icon file"),
                 self.tr("<p>The file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return False
         
-        self.__lastSavePath = fpath.parent
+        self.__lastSavePath = str(fpath.parent)
         
         return self.__saveIconFile(str(fpath))
     
--- a/eric7/Network/IRC/IrcChannelWidget.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Network/IRC/IrcChannelWidget.py	Fri Jun 17 16:36:14 2022 +0200
@@ -1385,7 +1385,7 @@
                         self,
                         self.tr("Save Messages"),
                         self.tr("<p>The file <b>{0}</b> already exists."
-                                " Overwrite it?</p>").format(str(fpath)),
+                                " Overwrite it?</p>").format(fpath),
                         icon=EricMessageBox.Warning)
                     if not res:
                         return
@@ -1405,7 +1405,7 @@
                         self.tr(
                             """<p>The messages contents could not be written"""
                             """ to <b>{0}</b></p><p>Reason: {1}</p>""")
-                        .format(str(fpath), str(err)))
+                        .format(fpath, str(err)))
     
     def __initMessagesMenu(self):
         """
--- a/eric7/Network/IRC/IrcNetworkWidget.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Network/IRC/IrcNetworkWidget.py	Fri Jun 17 16:36:14 2022 +0200
@@ -444,7 +444,7 @@
                         self,
                         self.tr("Save Messages"),
                         self.tr("<p>The file <b>{0}</b> already exists."
-                                " Overwrite it?</p>").format(str(fpath)),
+                                " Overwrite it?</p>").format(fpath),
                         icon=EricMessageBox.Warning)
                     if not res:
                         return
@@ -464,7 +464,7 @@
                         self.tr(
                             """<p>The messages contents could not be written"""
                             """ to <b>{0}</b></p><p>Reason: {1}</p>""")
-                        .format(str(fpath), str(err)))
+                        .format(fpath, str(err)))
     
     def __initMessagesMenu(self):
         """
--- a/eric7/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -9,8 +9,9 @@
 """
 
 import contextlib
+import pathlib
 
-from PyQt6.QtCore import pyqtSlot, QFileInfo, Qt
+from PyQt6.QtCore import pyqtSlot, Qt
 from PyQt6.QtGui import QTextCursor
 from PyQt6.QtWidgets import QWidget, QDialogButtonBox
 
@@ -22,7 +23,6 @@
 from .GitDiffHighlighter import GitDiffHighlighter
 from .GitDiffGenerator import GitDiffGenerator
 
-import Utilities
 import Preferences
 
 
@@ -331,25 +331,24 @@
         if not fname:
             return  # user aborted
         
-        ext = QFileInfo(fname).suffix()
-        if not ext:
+        fpath = pathlib.Path(fname)
+        if not fpath.suffix:
             ex = selectedFilter.split("(*")[1].split(")")[0]
             if ex:
-                fname += ex
-        if QFileInfo(fname).exists():
+                fpath = fpath.with_suffix(ex)
+        if fpath.exists():
             res = EricMessageBox.yesNo(
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(fname),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
-        fname = Utilities.toNativeSeparators(fname)
         
         eol = ericApp().getObject("Project").getEolString()
         try:
-            with open(fname, "w", encoding="utf-8", newline="") as f:
+            with fpath.open("w", encoding="utf-8", newline="") as f:
                 f.write(eol.join(self.contents2.toPlainText().splitlines()))
                 f.write(eol)
         except OSError as why:
@@ -358,7 +357,7 @@
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                .format(fname, str(why)))
+                .format(fpath, str(why)))
     
     @pyqtSlot()
     def on_refreshButton_clicked(self):
--- a/eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -11,9 +11,10 @@
 import collections
 import re
 import contextlib
+import pathlib
 
 from PyQt6.QtCore import (
-    pyqtSlot, Qt, QDate, QProcess, QTimer, QSize, QPoint, QFileInfo
+    pyqtSlot, Qt, QDate, QProcess, QTimer, QSize, QPoint
 )
 from PyQt6.QtGui import (
     QColor, QPixmap, QPainter, QPen, QIcon, QTextCursor, QPalette
@@ -36,7 +37,6 @@
 
 import UI.PixmapCache
 import Preferences
-import Utilities
 
 COLORNAMES = ["red", "green", "purple", "cyan", "olive", "magenta",
               "gray", "yellow", "darkred", "darkgreen", "darkblue",
@@ -1709,14 +1709,16 @@
             commits[index] = itm.text(self.CommitIdColumn)
         
         if commits:
-            pfile = ericApp().getObject("Project").getProjectFile()
-            lastModified = QFileInfo(pfile).lastModified().toString()
+            pfile = (
+                pathlib.Path(ericApp().getObject("Project").getProjectFile())
+            )
+            lastModified = pfile.stat().st_mtime
             shouldReopen = (
                 self.vcs.gitCherryPick(
                     self.repodir,
                     [commits[i] for i in sorted(commits.keys(), reverse=True)]
                 ) or
-                QFileInfo(pfile).lastModified().toString() != lastModified
+                pfile.stat().st_mtime != lastModified
             )
             if shouldReopen:
                 res = EricMessageBox.yesNo(
@@ -1772,11 +1774,13 @@
                 rev = branch
             else:
                 rev = commit
-            pfile = ericApp().getObject("Project").getProjectFile()
-            lastModified = QFileInfo(pfile).lastModified().toString()
+            pfile = (
+                pathlib.Path(ericApp().getObject("Project").getProjectFile())
+            )
+            lastModified = pfile.stat().st_mtime
             shouldReopen = (
                 self.vcs.vcsUpdate(self.repodir, revision=rev) or
-                QFileInfo(pfile).lastModified().toString() != lastModified
+                pfile.stat().st_mtime != lastModified
             )
             if shouldReopen:
                 res = EricMessageBox.yesNo(
@@ -1846,15 +1850,14 @@
                     return
             else:
                 branch = ""
-            pfile = ericApp().getObject("Project").getProjectFile()
-            lastModified = QFileInfo(pfile).lastModified().toString()
+            pfile = (
+                pathlib.Path(ericApp().getObject("Project").getProjectFile())
+            )
+            lastModified = pfile.stat().st_mtime
             res, shouldReopen = self.vcs.gitBranch(
                 self.repodir, revision=commit, branchName=branch,
                 branchOp=GitBranchDialog.CreateSwitchBranch)
-            shouldReopen = (
-                shouldReopen or
-                QFileInfo(pfile).lastModified().toString() != lastModified
-            )
+            shouldReopen |= pfile.stat().st_mtime != lastModified
             if res:
                 if shouldReopen:
                     res = EricMessageBox.yesNo(
@@ -2300,25 +2303,24 @@
         if not fname:
             return  # user aborted
         
-        ext = QFileInfo(fname).suffix()
-        if not ext:
+        fpath = pathlib.Path(fname)
+        if not fpath.suffix:
             ex = selectedFilter.split("(*")[1].split(")")[0]
             if ex:
-                fname += ex
-        if QFileInfo(fname).exists():
+                fpath = fpath.with_suffix(ex)
+        if fpath.exists():
             res = EricMessageBox.yesNo(
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(fname),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
-        fname = Utilities.toNativeSeparators(fname)
         
         eol = ericApp().getObject("Project").getEolString()
         try:
-            with open(fname, "w", encoding="utf-8", newline="") as f:
+            with fpath.open("w", encoding="utf-8", newline="") as f:
                 f.write(eol.join(self.diffEdit.toPlainText().splitlines()))
                 f.write(eol)
         except OSError as why:
@@ -2327,7 +2329,7 @@
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                .format(fname, str(why)))
+                .format(fpath, str(why)))
     
     @pyqtSlot(str)
     def on_sbsSelectLabel_linkActivated(self, link):
--- a/eric7/Plugins/VcsPlugins/vcsGit/ProjectHelper.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsGit/ProjectHelper.py	Fri Jun 17 16:36:14 2022 +0200
@@ -8,8 +8,8 @@
 """
 
 import os
+import pathlib
 
-from PyQt6.QtCore import QFileInfo
 from PyQt6.QtWidgets import QMenu, QInputDialog, QToolBar
 
 from EricWidgets import EricMessageBox
@@ -1666,11 +1666,11 @@
         """
         Private slot used to perform branch operations for the project.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBranch(self.project.getProjectPath())[1] or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1710,11 +1710,11 @@
         """
         Private slot used to pull changes from a remote repository.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitPull(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1735,11 +1735,11 @@
         """
         Private slot used to revert changes made to the local project.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.vcsRevert(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1754,11 +1754,11 @@
         """
         Private slot used to unstage changes made to the local project.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitUnstage(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1883,11 +1883,11 @@
         """
         Private slot used to copy commits into the current branch.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitCherryPick(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1903,11 +1903,11 @@
         Private slot used to continue the last copying session after conflicts
         were resolved.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitCherryPickContinue(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1922,11 +1922,11 @@
         """
         Private slot used to quit the current copying operation.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitCherryPickQuit(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1942,11 +1942,11 @@
         Private slot used to cancel the last copying session and return to
         the previous state.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitCherryPickAbort(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1961,11 +1961,11 @@
         """
         Private slot to stash all current changes.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitStashSave(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -1992,11 +1992,11 @@
         """
         Private slot to restore a stash and keep it.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitStashApply(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2011,11 +2011,11 @@
         """
         Private slot to restore a stash and delete it.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitStashPop(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2030,11 +2030,11 @@
         """
         Private slot to create a new branch and restore a stash into it.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitStashBranch(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2147,11 +2147,11 @@
         """
         Private slot to apply a head of a bundle file using the pull method.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBundlePull(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2172,12 +2172,12 @@
         """
         Private slot used to execute the bisect start command with options.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBisect(self.project.getProjectPath(),
                                "start_extended") or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2192,11 +2192,11 @@
         """
         Private slot used to execute the bisect good command.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBisect(self.project.getProjectPath(), "good") or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2211,11 +2211,11 @@
         """
         Private slot used to execute the bisect bad command.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBisect(self.project.getProjectPath(), "bad") or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2230,11 +2230,11 @@
         """
         Private slot used to execute the bisect skip command.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBisect(self.project.getProjectPath(), "skip") or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2249,11 +2249,11 @@
         """
         Private slot used to execute the bisect reset command.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBisect(self.project.getProjectPath(), "reset") or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2287,11 +2287,11 @@
         """
         Private slot used to replay a bisect session.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         shouldReopen = (
             self.vcs.gitBisectReplay(self.project.getProjectPath()) or
-            QFileInfo(pfile).lastModified().toString() != lastModified
+            pfile.stat().st_mtime != lastModified
         )
         if shouldReopen:
             res = EricMessageBox.yesNo(
@@ -2314,10 +2314,10 @@
         """
         Private slot to apply a list of patch files.
         """
-        pfile = self.project.getProjectFile()
-        lastModified = QFileInfo(pfile).lastModified().toString()
+        pfile = pathlib.Path(self.project.getProjectFile())
+        lastModified = pfile.stat().st_mtime
         self.vcs.gitApplyCheckPatches(self.project.getProjectPath())
-        if QFileInfo(pfile).lastModified().toString() != lastModified:
+        if pfile.stat().st_mtime != lastModified:
             res = EricMessageBox.yesNo(
                 self.parent(),
                 self.tr("Apply patch files"),
--- a/eric7/Plugins/VcsPlugins/vcsGit/git.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsGit/git.py	Fri Jun 17 16:36:14 2022 +0200
@@ -11,8 +11,9 @@
 import shutil
 import re
 import contextlib
+import pathlib
 
-from PyQt6.QtCore import QProcess, pyqtSignal, QFileInfo
+from PyQt6.QtCore import QProcess, pyqtSignal
 from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog, QLineEdit
 
 from EricWidgets.EricApplication import ericApp
@@ -2343,27 +2344,27 @@
             if not fname:
                 return  # user aborted
             
-            ext = QFileInfo(fname).suffix()
-            if not ext:
+            fpath = pathlib.Path(fname)
+            if not fpath.suffix:
                 ex = selectedFilter.split("(*")[1].split(")")[0]
                 if ex:
-                    fname += ex
-            if QFileInfo(fname).exists():
+                    fpath = fpath.with_suffix(ex)
+            if fpath.exists():
                 res = EricMessageBox.yesNo(
                     self.__ui,
                     self.tr("Create Bundle"),
                     self.tr("<p>The Git bundle file <b>{0}</b> "
                             "already exists. Overwrite it?</p>")
-                        .format(fname),
+                        .format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
-            fname = Utilities.toNativeSeparators(fname)
-            self.__lastBundlePath = os.path.dirname(fname)
+            
+            self.__lastBundlePath = str(fpath.parent)
             
             args = self.initCommand("bundle")
             args.append("create")
-            args.append(fname)
+            args.append(str(fpath))
             for rev in revs:
                 args.append(rev)
             
@@ -2694,26 +2695,25 @@
             if not fname:
                 return  # user aborted
             
-            ext = QFileInfo(fname).suffix()
-            if not ext:
+            fpath = pathlib.Path(fname)
+            if not fpath.suffix:
                 ex = selectedFilter.split("(*")[1].split(")")[0]
                 if ex:
-                    fname += ex
-            if QFileInfo(fname).exists():
+                    fpath = fpath.with_suffix(ex)
+            if fpath.exists():
                 res = EricMessageBox.yesNo(
                     self.__ui,
                     self.tr("Create Bisect Replay File"),
                     self.tr("<p>The Git bisect replay file <b>{0}</b> "
                             "already exists. Overwrite it?</p>")
-                        .format(fname),
+                        .format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
-            fname = Utilities.toNativeSeparators(fname)
-            self.__lastReplayPath = os.path.dirname(fname)
+            self.__lastReplayPath = str(fpath.parent)
             
             try:
-                with open(fname, "w") as f:
+                with fpath.open("w") as f:
                     f.write(output)
             except OSError as err:
                 EricMessageBox.critical(
@@ -2722,7 +2722,7 @@
                     self.tr(
                         """<p>The file <b>{0}</b> could not be written.</p>"""
                         """<p>Reason: {1}</p>""")
-                    .format(fname, str(err)))
+                    .format(fpath, str(err)))
     
     def gitBisectEditReplayFile(self, projectDir):
         """
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -241,7 +241,7 @@
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -256,7 +256,7 @@
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                .format(str(fpath), str(why)))
+                .format(fpath, str(why)))
     
     @pyqtSlot()
     def on_refreshButton_clicked(self):
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -2696,7 +2696,7 @@
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -2711,7 +2711,7 @@
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                .format(str(fpath), str(why)))
+                .format(fpath, str(why)))
     
     @pyqtSlot(str)
     def on_sbsSelectLabel_linkActivated(self, link):
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Jun 17 16:36:14 2022 +0200
@@ -2146,12 +2146,12 @@
                 self.tr("Create changegroup"),
                 self.tr("<p>The Mercurial changegroup file <b>{0}</b> "
                         "already exists. Overwrite it?</p>")
-                    .format(str(fpath)),
+                    .format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
         
-        self.__lastChangeGroupPath = fpath.parent
+        self.__lastChangeGroupPath = str(fpath.parent)
         
         args = self.initCommand("bundle")
         if bundleAll:
--- a/eric7/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -442,7 +442,7 @@
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -457,7 +457,7 @@
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                .format(str(fpath), str(why)))
+                .format(fpath, str(why)))
         
     @pyqtSlot()
     def on_refreshButton_clicked(self):
--- a/eric7/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -395,7 +395,7 @@
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -410,7 +410,7 @@
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
-                .format(str(fpath), str(why)))
+                .format(fpath, str(why)))
         
     @pyqtSlot()
     def on_refreshButton_clicked(self):
--- a/eric7/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -338,7 +338,7 @@
                     self,
                     self.tr("Save regular expression"),
                     self.tr("<p>The file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(str(fpath)),
+                            " Overwrite it?</p>").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
--- a/eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -421,7 +421,7 @@
                     self,
                     self.tr("Save regular expression"),
                     self.tr("<p>The file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(str(fpath)),
+                            " Overwrite it?</p>").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return
--- a/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Fri Jun 17 16:36:14 2022 +0200
@@ -573,7 +573,7 @@
                 self,
                 self.tr("Export Highlighting Styles"),
                 self.tr("""<p>The highlighting styles file <b>{0}</b> exists"""
-                        """ already. Overwrite it?</p>""").format(str(fpath)))
+                        """ already. Overwrite it?</p>""").format(fpath))
             if fpath.exists() else
             True
         )
--- a/eric7/Project/Project.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Project/Project.py	Fri Jun 17 16:36:14 2022 +0200
@@ -3140,7 +3140,7 @@
                     self.ui,
                     self.tr("Save File"),
                     self.tr("""<p>The file <b>{0}</b> already exists."""
-                            """ Overwrite it?</p>""").format(str(fpath)),
+                            """ Overwrite it?</p>""").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return False
--- a/eric7/Project/ProjectFormsBrowser.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Project/ProjectFormsBrowser.py	Fri Jun 17 16:36:14 2022 +0200
@@ -629,7 +629,7 @@
                 self.tr("New Form"),
                 self.tr(
                     "<p>The new form file <b>{0}</b> could not be created.<br>"
-                    "Problem: {1}</p>").format(str(fpath), str(err)))
+                    "Problem: {1}</p>").format(fpath, str(err)))
             return
         
         self.project.appendFile(str(fpath))
--- a/eric7/Project/ProjectResourcesBrowser.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Project/ProjectResourcesBrowser.py	Fri Jun 17 16:36:14 2022 +0200
@@ -510,7 +510,7 @@
                     self.tr(
                         "<p>The new resource file <b>{0}</b> could not"
                         " be created.<br>Problem: {1}</p>")
-                    .format(str(fpath), str(e)))
+                    .format(fpath, str(e)))
                 return
             
             self.project.appendFile(str(fpath))
--- a/eric7/QScintilla/Editor.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/QScintilla/Editor.py	Fri Jun 17 16:36:14 2022 +0200
@@ -3389,7 +3389,7 @@
                     self,
                     self.tr("Save File"),
                     self.tr("<p>The file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(str(fpath)),
+                            " Overwrite it?</p>").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return ""
@@ -6887,7 +6887,7 @@
                 self,
                 self.tr("Save macro"),
                 self.tr("<p>The macro file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -6902,7 +6902,7 @@
                 self.tr("Error saving macro"),
                 self.tr(
                     "<p>The macro file <b>{0}</b> could not be written.</p>")
-                .format(str(fpath)))
+                .format(fpath))
             return
         
     def macroRecordingStart(self):
--- a/eric7/QScintilla/Exporters/ExporterBase.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/QScintilla/Exporters/ExporterBase.py	Fri Jun 17 16:36:14 2022 +0200
@@ -60,7 +60,7 @@
                     QCoreApplication.translate(
                         'Exporter',
                         "<p>The file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                     icon=EricMessageBox.Warning)
                 if not res:
                     return ""
--- a/eric7/QScintilla/Shell.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/QScintilla/Shell.py	Fri Jun 17 16:36:14 2022 +0200
@@ -2410,7 +2410,7 @@
                         self,
                         self.tr("Save Shell Contents"),
                         self.tr("<p>The file <b>{0}</b> already exists."
-                                " Overwrite it?</p>").format(str(fpath)),
+                                " Overwrite it?</p>").format(fpath),
                         icon=EricMessageBox.Warning)
                     if not res:
                         return
@@ -2423,7 +2423,7 @@
                     self.tr("Save Shell Contents"),
                     self.tr('<p>The file <b>{0}</b> could not be saved.<br/>'
                             'Reason: {1}</p>')
-                    .format(str(fpath), str(why)))
+                    .format(fpath, str(why)))
     
     #################################################################
     ## Project Support
--- a/eric7/Templates/TemplateViewer.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Templates/TemplateViewer.py	Fri Jun 17 16:36:14 2022 +0200
@@ -599,8 +599,7 @@
                     self,
                     self.tr("Export Templates"),
                     self.tr("""<p>The templates file <b>{0}</b> exists"""
-                            """ already. Overwrite it?</p>""")
-                    .format(str(fpath)))
+                            """ already. Overwrite it?</p>""").format(fpath))
             else:
                 ok = True
             
--- a/eric7/Tools/UIPreviewer.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/Tools/UIPreviewer.py	Fri Jun 17 16:36:14 2022 +0200
@@ -485,7 +485,7 @@
                 self.tr("Save Image"),
                 self.tr(
                     """<p>The file <b>{0}</b> could not be saved.</p>""")
-                .format(str(fpath)))
+                .format(fpath))
 
     def __copyImageToClipboard(self):
         """
--- a/eric7/UI/DiffDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/UI/DiffDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -125,7 +125,7 @@
                 self,
                 self.tr("Save Diff"),
                 self.tr("<p>The patch file <b>{0}</b> already exists."
-                        " Overwrite it?</p>").format(str(fpath)),
+                        " Overwrite it?</p>").format(fpath),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
@@ -140,7 +140,7 @@
                 self, self.tr('Save Diff'),
                 self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.<br />'
-                    'Reason: {1}</p>').format(str(fpath), str(why)))
+                    'Reason: {1}</p>').format(fpath, str(why)))
 
     @pyqtSlot()
     def on_diffButton_clicked(self):
--- a/eric7/UI/UserInterface.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/UI/UserInterface.py	Fri Jun 17 16:36:14 2022 +0200
@@ -6771,7 +6771,7 @@
                 self,
                 self.tr("Export Keyboard Shortcuts"),
                 self.tr("""<p>The keyboard shortcuts file <b>{0}</b> exists"""
-                        """ already. Overwrite it?</p>""").format(str(fpath)))
+                        """ already. Overwrite it?</p>""").format(fpath))
             if fpath.exists() else
             True
         )
--- a/eric7/VCS/ProjectHelper.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/VCS/ProjectHelper.py	Fri Jun 17 16:36:14 2022 +0200
@@ -10,8 +10,9 @@
 import os
 import shutil
 import copy
+import pathlib
 
-from PyQt6.QtCore import pyqtSlot, QDir, QFileInfo, QObject, QCoreApplication
+from PyQt6.QtCore import pyqtSlot, QObject, QCoreApplication
 from PyQt6.QtWidgets import QDialog, QInputDialog, QToolBar
 
 from EricGui.EricAction import EricAction
@@ -267,22 +268,17 @@
                     ok = vcs.vcsCheckout(vcsDataDict, projectdir, False)
                 if ok:
                     projectdir = os.path.normpath(projectdir)
+                    dpath = pathlib.Path(projectdir)
                     # look for JSON style project file first
-                    filters = ["*.epj"]
-                    # TODO: replace QDir and QFileInfo using pathlib
-                    d = QDir(projectdir)
-                    plist = d.entryInfoList(filters)
+                    plist = list(dpath.glob("*.epj"))
                     if not plist:
                         # look for XML style project file second
-                        filters = ["*.e4p"]
-                        d = QDir(projectdir)
-                        plist = d.entryInfoList(filters)
+                        plist = list(dpath.glob("*.e4p"))
                     if plist:
                         if len(plist) == 1:
-                            self.project.openProject(
-                                plist[0].absoluteFilePath())
+                            self.project.openProject(str(plist[0].resolve()))
                         else:
-                            pfilenamelist = d.entryList(filters)
+                            pfilenamelist = [p.name for p in plist]
                             pfilename, ok = QInputDialog.getItem(
                                 None,
                                 QCoreApplication.translate(
@@ -294,7 +290,7 @@
                                 pfilenamelist, 0, False)
                             if ok:
                                 self.project.openProject(
-                                    QFileInfo(d, pfilename).absoluteFilePath())
+                                    str(dpath / pfilename))
                         if export:
                             self.project.pdata["VCS"] = 'None'
                             self.project.vcs = self.project.initVCS()
--- a/eric7/WebBrowser/Bookmarks/BookmarksManager.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/Bookmarks/BookmarksManager.py	Fri Jun 17 16:36:14 2022 +0200
@@ -9,10 +9,11 @@
 
 import os
 import contextlib
+import pathlib
 
 from PyQt6.QtCore import (
     pyqtSignal, QT_TRANSLATE_NOOP, QObject, QFile, QIODevice, QXmlStreamReader,
-    QDateTime, QFileInfo, QUrl, QCoreApplication
+    QDateTime, QUrl, QCoreApplication
 )
 from PyQt6.QtGui import QUndoStack, QUndoCommand
 from PyQt6.QtWidgets import QDialog
@@ -398,25 +399,24 @@
         if not fileName:
             return
         
-        ext = QFileInfo(fileName).suffix()
-        if not ext:
+        fpath = pathlib.Path(fileName)
+        if not fpath.suffix:
             ex = selectedFilter.split("(*")[1].split(")")[0]
             if ex:
-                fileName += ex
+                fpath = fpath.with_suffix(ex)
         
-        ext = QFileInfo(fileName).suffix()
-        if ext == "html":
+        if fpath.suffix == ".html":
             from .NsHtmlWriter import NsHtmlWriter
             writer = NsHtmlWriter()
         else:
             from .XbelWriter import XbelWriter
             writer = XbelWriter()
-        if not writer.write(fileName, self.__bookmarkRootNode):
+        if not writer.write(str(fpath), self.__bookmarkRootNode):
             EricMessageBox.critical(
                 None,
                 self.tr("Exporting Bookmarks"),
                 self.tr("""Error exporting bookmarks to <b>{0}</b>.""")
-                .format(fileName))
+                .format(fpath))
     
     def faviconChanged(self, url):
         """
--- a/eric7/WebBrowser/Download/DownloadItem.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/Download/DownloadItem.py	Fri Jun 17 16:36:14 2022 +0200
@@ -9,9 +9,10 @@
 
 import enum
 import os
+import pathlib
 
 from PyQt6.QtCore import (
-    pyqtSlot, pyqtSignal, QTime, QUrl, QStandardPaths, QFileInfo, QDateTime
+    pyqtSlot, pyqtSignal, QTime, QUrl, QStandardPaths, QDateTime
 )
 from PyQt6.QtGui import QDesktopServices
 from PyQt6.QtWidgets import QWidget, QStyle, QDialog
@@ -180,7 +181,7 @@
             url = self.__downloadRequest.url()
             mimetype = Utilities.MimeTypes.mimeType(originalFileName)
             dlg = DownloadAskActionDialog(
-                QFileInfo(originalFileName).fileName(),
+                pathlib.Path(originalFileName).name,
                 mimetype,
                 "{0}://{1}".format(url.scheme(), url.authority()),
                 self)
@@ -193,7 +194,7 @@
                 self.on_stopButton_clicked()
                 self.filenameLabel.setText(
                     self.tr("Download canceled: {0}").format(
-                        QFileInfo(defaultFileName).fileName()))
+                        pathlib.Path(defaultFileName).name))
                 self.__canceledFileSelect = True
                 self.__setDateTime()
                 return
@@ -205,7 +206,7 @@
                 self.on_stopButton_clicked()
                 self.filenameLabel.setText(
                     self.tr("VirusTotal scan scheduled: {0}").format(
-                        QFileInfo(defaultFileName).fileName()))
+                        pathlib.Path(defaultFileName).name))
                 self.__canceledFileSelect = True
                 return
         
@@ -215,7 +216,7 @@
                 QStandardPaths.StandardLocation.TempLocation)
             fileName = (
                 tempLocation + '/' +
-                QFileInfo(fileName).completeBaseName()
+                pathlib.Path(fileName).stem
             )
             
             if ask and not self.__autoOpen:
@@ -232,7 +233,7 @@
             self.on_stopButton_clicked()
             self.filenameLabel.setText(
                 self.tr("Download canceled: {0}")
-                    .format(QFileInfo(defaultFileName).fileName()))
+                    .format(pathlib.Path(defaultFileName).name))
             self.__canceledFileSelect = True
             self.__setDateTime()
             return
@@ -246,28 +247,17 @@
         @param fileName name of the file to save into
         @type str
         """
-        fileInfo = QFileInfo(fileName)
+        fpath = pathlib.Path(fileName)
         WebBrowserWindow.downloadManager().setDownloadDirectory(
-            fileInfo.absoluteDir().absolutePath())
-        self.filenameLabel.setText(fileInfo.fileName())
+            fpath.parent.resolve())
+        self.filenameLabel.setText(fpath.name)
         
-        self.__fileName = fileName
+        self.__fileName = str(fpath)
         
         # check file path for saving
-        saveDirPath = QFileInfo(self.__fileName).dir()
-        if (
-            not saveDirPath.exists() and
-            not saveDirPath.mkpath(saveDirPath.absolutePath())
-        ):
-            self.progressBar.setVisible(False)
-            self.on_stopButton_clicked()
-            self.infoLabel.setText(self.tr(
-                "Download directory ({0}) couldn't be created.")
-                .format(saveDirPath.absolutePath()))
-            self.__setDateTime()
-            return
-        
-        self.filenameLabel.setText(QFileInfo(self.__fileName).fileName())
+        saveDirPath = pathlib.Path(self.__fileName).parent()
+        if not saveDirPath.exists():
+            saveDirPath.mkdir(parents=True)
     
     def __saveFileName(self, directory):
         """
@@ -276,18 +266,9 @@
         @param directory name of the directory to store the file into (string)
         @return proposed filename and original filename (string, string)
         """
-        path = self.__downloadRequest.downloadFileName()
-        info = QFileInfo(path)
-        baseName = info.completeBaseName()
-        endName = info.suffix()
-        
-        origName = baseName
-        if endName:
-            origName += '.' + endName
-        
-        name = os.path.join(directory, baseName)
-        if endName:
-            name += '.' + endName
+        fpath = pathlib.Path(self.__downloadRequest.downloadFileName())
+        origName = fpath.name
+        name = os.path.join(directory, origName)
         return name, origName
     
     @pyqtSlot(bool)
@@ -338,16 +319,14 @@
         """
         Public slot to open the downloaded file.
         """
-        info = QFileInfo(self.__fileName)
-        url = QUrl.fromLocalFile(info.absoluteFilePath())
+        url = QUrl.fromLocalFile(pathlib.Path(self.__fileName).resolve())
         QDesktopServices.openUrl(url)
     
     def openFolder(self):
         """
         Public slot to open the folder containing the downloaded file.
         """
-        info = QFileInfo(self.__fileName)
-        url = QUrl.fromLocalFile(info.absolutePath())
+        url = QUrl.fromLocalFile(pathlib.Path(self.__fileName).resolve())
         QDesktopServices.openUrl(url)
     
     @pyqtSlot()
@@ -554,7 +533,7 @@
         
         @return absolute path of the output file (string)
         """
-        return QFileInfo(self.__fileName).absoluteFilePath()
+        return pathlib.Path(self.__fileName).resolve()
     
     def getData(self):
         """
@@ -568,7 +547,7 @@
         """
         return {
             "URL": self.__url,
-            "Location": QFileInfo(self.__fileName).filePath(),
+            "Location": self.__fileName,
             "Done": self.downloadedSuccessfully(),
             "PageURL": self.__pageUrl,
             "Downloaded": self.__downloadedDateTime
@@ -588,7 +567,7 @@
         self.__fileName = data["Location"]
         self.__pageUrl = data["PageURL"]
         
-        self.filenameLabel.setText(QFileInfo(self.__fileName).fileName())
+        self.filenameLabel.setText(pathlib.Path(self.__fileName).name)
         self.infoLabel.setText(self.__fileName)
         
         try:
--- a/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py	Fri Jun 17 16:36:14 2022 +0200
@@ -8,8 +8,9 @@
 """
 
 import os
+import pathlib
 
-from PyQt6.QtCore import pyqtSignal, pyqtSlot, QObject, QSettings, QFileInfo
+from PyQt6.QtCore import pyqtSignal, pyqtSlot, QObject, QSettings
 from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest
 
 from WebBrowser.WebBrowserWindow import WebBrowserWindow
@@ -125,8 +126,7 @@
                 self.__reply.request().url().toString())
             if not self.__fileName:
                 name = (
-                    QFileInfo(self.__reply.request().url().path())
-                    .fileName()
+                    pathlib.Path(self.__reply.request().url().path()).name
                 )
                 if not name:
                     name = "require.js"
@@ -137,7 +137,7 @@
                 from WebBrowser.Tools import WebBrowserTools
                 self.__fileName = WebBrowserTools.ensureUniqueFilename(
                     filePath, "{0}")
-            if not QFileInfo(self.__fileName).isAbsolute():
+            if not pathlib.Path(self.__fileName).is_absolute():
                 self.__fileName = os.path.join(
                     self.__manager.requireScriptsDirectory(),
                     self.__fileName)
@@ -150,6 +150,6 @@
             return
         
         settings.setValue(self.__reply.request().url().toString(),
-                          QFileInfo(self.__fileName).fileName())
+                          pathlib.Path(self.__fileName).name)
         
         self.finished.emit(self.__fileName)
--- a/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py	Fri Jun 17 16:36:14 2022 +0200
@@ -9,10 +9,11 @@
 
 import os
 import contextlib
+import pathlib
 
 from PyQt6.QtCore import (
-    pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QFile, QFileInfo, QDir,
-    QSettings, QMetaObject, QUrl, Q_ARG, QCoreApplication
+    pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QFile, QDir, QSettings,
+    QMetaObject, QUrl, Q_ARG, QCoreApplication
 )
 from PyQt6.QtWidgets import QDialog
 
@@ -169,7 +170,7 @@
         for url in urlList:
             if settings.contains(url):
                 fileName = settings.value(url)
-                if not QFileInfo(fileName).isAbsolute():
+                if not pathlib.Path(fileName).is_absolute():
                     fileName = os.path.join(self.requireScriptsDirectory(),
                                             fileName)
                 try:
--- a/eric7/WebBrowser/History/HistoryManager.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/History/HistoryManager.py	Fri Jun 17 16:36:14 2022 +0200
@@ -8,10 +8,11 @@
 """
 
 import os
+import pathlib
 
 from PyQt6.QtCore import (
-    pyqtSignal, pyqtSlot, QFileInfo, QDateTime, QDate, QTime, QUrl, QTimer,
-    QFile, QIODevice, QByteArray, QDataStream, QTemporaryFile, QObject
+    pyqtSignal, pyqtSlot, QDateTime, QDate, QTime, QUrl, QTimer, QFile,
+    QIODevice, QByteArray, QDataStream, QTemporaryFile, QObject
 )
 
 from EricWidgets import EricMessageBox
@@ -76,7 +77,7 @@
         @return title of the entry (string)
         """
         if not self.title:
-            page = QFileInfo(QUrl(self.url).path()).fileName()
+            page = pathlib.Path(QUrl(self.url).path()).name
             if page:
                 return page
             return self.url
--- a/eric7/WebBrowser/PageScreenDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/PageScreenDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -7,7 +7,9 @@
 Module implementing a dialog to save a screenshot of a web page.
 """
 
-from PyQt6.QtCore import pyqtSlot, Qt, QFile, QFileInfo, QSize, QIODevice
+import pathlib
+
+from PyQt6.QtCore import pyqtSlot, Qt, QFile, QSize, QIODevice
 from PyQt6.QtGui import QImage, QPainter, QPixmap
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton
 
@@ -75,7 +77,7 @@
         if not fileName:
             return False
         
-        if QFileInfo(fileName).exists():
+        if pathlib.Path(fileName).exists():
             res = EricMessageBox.yesNo(
                 self,
                 self.tr("Save Page Screen"),
--- a/eric7/WebBrowser/QtHelp/HelpDocsInstaller.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/QtHelp/HelpDocsInstaller.py	Fri Jun 17 16:36:14 2022 +0200
@@ -8,11 +8,10 @@
 documentation database.
 """
 
-import os
+import datetime
+import pathlib
 
-from PyQt6.QtCore import (
-    pyqtSignal, QThread, Qt, QMutex, QDateTime, QDir, QLibraryInfo, QFileInfo
-)
+from PyQt6.QtCore import pyqtSignal, QThread, QMutex, QLibraryInfo
 from PyQt6.QtHelp import QHelpEngineCore
 
 from eric7config import getConfig
@@ -125,70 +124,65 @@
         info = engine.customValue(versionKey, "")
         lst = info.split('|')
         
-        dt = QDateTime()
+        dt = None
         if len(lst) and lst[0]:
-            dt = QDateTime.fromString(lst[0], Qt.DateFormat.ISODate)
+            dt = datetime.datetime.fromisoformat(lst[0])
         
         qchFile = ""
         if len(lst) == 2:
             qchFile = lst[1]
         
         if version == 5:
-            docsPath = QLibraryInfo.path(
-                QLibraryInfo.LibraryPath.DocumentationPath)
+            docsPath = pathlib.Path(QLibraryInfo.path(
+                QLibraryInfo.LibraryPath.DocumentationPath))
             if (
-                not os.path.isdir(docsPath) or
-                len(QDir(docsPath).entryList(["*.qch"])) == 0
+                not docsPath.is_dir() or
+                len(docsPath.glob("*.qch")) == 0
             ):
-                docsPathList = QDir.fromNativeSeparators(docsPath).split("/")
-                docsPath = os.sep.join(
-                    docsPathList[:-3] +
-                    ["Docs", "Qt-{0}.{1}".format(*qVersionTuple())])
-            docsPath = QDir(docsPath)
+                docsPath = (
+                    docsPath.parents[2] / "Docs" /
+                    "Qt-{0}.{1}".format(*qVersionTuple())
+                )
         else:
             # unsupported Qt version
             return False
         
-        files = docsPath.entryList(["*.qch"])
+        files = docsPath.glob("*.qch")
         if not files:
-            engine.setCustomValue(
-                versionKey,
-                QDateTime().toString(Qt.DateFormat.ISODate) + '|')
+            engine.setCustomValue(versionKey, '|')
             return False
         
         for f in files:
-            if f.startswith(name + "."):
-                fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f)
-                namespace = QHelpEngineCore.namespaceName(
-                    fi.absoluteFilePath())
+            if f.stem == name:
+                namespace = QHelpEngineCore.namespaceName(str(f.resolve()))
                 if not namespace:
                     continue
                 
                 if (
-                    dt.isValid() and
+                    dt is not None and
                     namespace in engine.registeredDocumentations() and
-                    (fi.lastModified().toString(Qt.DateFormat.ISODate) ==
-                     dt.toString(Qt.DateFormat.ISODate)) and
-                    qchFile == fi.absoluteFilePath()
+                    (datetime.datetime.fromtimestamp(f.stat().st_mtime) ==
+                     dt) and
+                    qchFile == str(f.resolve())
                 ):
                     return False
                 
                 if namespace in engine.registeredDocumentations():
                     engine.unregisterDocumentation(namespace)
                 
-                if not engine.registerDocumentation(fi.absoluteFilePath()):
+                if not engine.registerDocumentation(str(f.resolve())):
                     self.errorMessage.emit(
                         self.tr(
                             """<p>The file <b>{0}</b> could not be"""
                             """ registered. <br/>Reason: {1}</p>""")
-                        .format(fi.absoluteFilePath, engine.error())
+                        .format(f, engine.error())
                     )
                     return False
                 
                 engine.setCustomValue(
                     versionKey,
-                    fi.lastModified().toString(Qt.DateFormat.ISODate) + '|' +
-                    fi.absoluteFilePath())
+                    datetime.datetime.fromtimestamp(f.stat().st_mtime)
+                    .isoformat() + '|' + str(f.resolve()))
                 return True
         
         return False
@@ -206,55 +200,52 @@
         info = engine.customValue(versionKey, "")
         lst = info.split('|')
         
-        dt = QDateTime()
+        dt = None
         if len(lst) and lst[0]:
-            dt = QDateTime.fromString(lst[0], Qt.DateFormat.ISODate)
+            dt = datetime.datetime.fromisoformat(lst[0])
         
         qchFile = ""
         if len(lst) == 2:
             qchFile = lst[1]
         
-        docsPath = QDir(getConfig("ericDocDir") + QDir.separator() + "Help")
+        docsPath = pathlib.Path(getConfig("ericDocDir")) / "Help"
         
-        files = docsPath.entryList(["*.qch"])
+        files = docsPath.glob("*.qch")
         if not files:
-            engine.setCustomValue(
-                versionKey, QDateTime().toString(Qt.DateFormat.ISODate) + '|')
+            engine.setCustomValue(versionKey, '|')
             return False
         
         for f in files:
-            if f == "source.qch":
-                fi = QFileInfo(docsPath.absolutePath() + QDir.separator() + f)
-                namespace = QHelpEngineCore.namespaceName(
-                    fi.absoluteFilePath())
+            if f.name == "source.qch":
+                namespace = QHelpEngineCore.namespaceName(str(f.resolve()))
                 if not namespace:
                     continue
                 
                 if (
-                    dt.isValid() and
+                    dt is not None and
                     namespace in engine.registeredDocumentations() and
-                    (fi.lastModified().toString(Qt.DateFormat.ISODate) ==
-                     dt.toString(Qt.DateFormat.ISODate)) and
-                    qchFile == fi.absoluteFilePath()
+                    (datetime.datetime.fromtimestamp(f.stat().st_mtime) ==
+                     dt) and
+                    qchFile == str(f.resolve())
                 ):
                     return False
                 
                 if namespace in engine.registeredDocumentations():
                     engine.unregisterDocumentation(namespace)
                 
-                if not engine.registerDocumentation(fi.absoluteFilePath()):
+                if not engine.registerDocumentation(str(f.resolve())):
                     self.errorMessage.emit(
                         self.tr(
                             """<p>The file <b>{0}</b> could not be"""
                             """ registered. <br/>Reason: {1}</p>""")
-                        .format(fi.absoluteFilePath, engine.error())
+                        .format(f, engine.error())
                     )
                     return False
                 
                 engine.setCustomValue(
                     versionKey,
-                    fi.lastModified().toString(Qt.DateFormat.ISODate) + '|' +
-                    fi.absoluteFilePath())
+                    datetime.datetime.fromtimestamp(f.stat().st_mtime)
+                    .isoformat() + '|' + str(f.resolve()))
                 return True
         
         return False
--- a/eric7/WebBrowser/Session/SessionManager.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/Session/SessionManager.py	Fri Jun 17 16:36:14 2022 +0200
@@ -11,10 +11,11 @@
 import json
 import functools
 import contextlib
+import pathlib
 
 from PyQt6.QtCore import (
-    pyqtSlot, pyqtSignal, Qt, QObject, QTimer, QDir, QFile, QFileInfo,
-    QFileSystemWatcher, QByteArray, QDateTime
+    pyqtSlot, pyqtSignal, Qt, QObject, QTimer, QDir, QFile, QFileSystemWatcher,
+    QByteArray, QDateTime
 )
 from PyQt6.QtGui import QActionGroup
 from PyQt6.QtWidgets import (
@@ -309,24 +310,22 @@
         if self.__sessionMetaData:
             return
         
-        sessionFilesInfoList = QDir(self.getSessionsDirectory()).entryInfoList(
-            ["*.json"], QDir.Filter.Files, QDir.SortFlag.Time)
+        sessionFiles = pathlib.Path(self.getSessionsDirectory()).glob("*.json")
         
-        for sessionFileInfo in sessionFilesInfoList:
-            sessionData = self.readSessionFromFile(
-                sessionFileInfo.absoluteFilePath())
+        for sessionFile in sessionFiles:
+            sessionData = self.readSessionFromFile(sessionFile.resolve())
             if not sessionData or not sessionData["Windows"]:
                 continue
             
             data = SessionMetaData()
-            data.name = sessionFileInfo.baseName()
-            data.filePath = sessionFileInfo.canonicalFilePath()
+            data.name = sessionFile.stem
+            data.filePath = sessionFile.resolve()
             
-            if sessionFileInfo == QFileInfo(self.defaultSessionFile()):
+            if sessionFile == pathlib.Path(self.defaultSessionFile()):
                 data.name = self.tr("Default Session")
                 data.isDefault = True
             
-            if self.__isActive(sessionFileInfo):
+            if self.__isActive(sessionFile):
                 data.isActive = True
             
             if data.isDefault:
@@ -340,11 +339,11 @@
         Private method to check, if a given file is the active one.
         
         @param filePath path of the session file to be checked
-        @type str or QFileInfo
+        @type str or pathlib.Path
         @return flag indicating the active file
         @rtype bool
         """
-        return QFileInfo(filePath) == QFileInfo(self.__lastActiveSession)
+        return pathlib.Path(filePath) == pathlib.Path(self.__lastActiveSession)
     
     @pyqtSlot()
     def __sessionDirectoryChanged(self):
@@ -424,7 +423,7 @@
                 SessionManager.ReplaceSession
             ):
                 self.__lastActiveSession = (
-                    QFileInfo(sessionFilePath).canonicalFilePath()
+                    pathlib.Path(sessionFilePath).resolve()
                 )
                 self.__sessionMetaData = []
         
@@ -485,7 +484,7 @@
         """
         from WebBrowser.WebBrowserWindow import WebBrowserWindow
         
-        suggestedName = QFileInfo(sessionFilePath).baseName()
+        suggestedName = pathlib.Path(sessionFilePath).stem
         if flags & SessionManager.CloneSession:
             suggestedName += "_cloned"
             title = self.tr("Clone Session")
@@ -620,7 +619,7 @@
             WebBrowserWindow.getWindow(),
             self.tr("Delete Session"),
             self.tr("""Are you sure you want to delete session "{0}"?""")
-            .format(QFileInfo(sessionFilePath).baseName()))
+            .format(pathlib.Path(sessionFilePath).stem))
         if res:
             QFile.remove(sessionFilePath)
     
@@ -704,10 +703,13 @@
             layout.addWidget(buttonBox)
             dlg.setLayout(layout)
             
-            lastActiveSessionFileInfo = QFileInfo(self.__lastActiveSession)
+            lastActiveSessionFilePath = pathlib.Path(self.__lastActiveSession)
             
             for metaData in self.__sessionMetaData:
-                if QFileInfo(metaData.filePath) != lastActiveSessionFileInfo:
+                if (
+                    pathlib.Path(metaData.filePath) !=
+                    lastActiveSessionFilePath
+                ):
                     combo.addItem(metaData.name, metaData.filePath)
                 else:
                     combo.insertItem(
--- a/eric7/WebBrowser/Session/SessionManagerDialog.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/Session/SessionManagerDialog.py	Fri Jun 17 16:36:14 2022 +0200
@@ -7,7 +7,10 @@
 Module implementing a dialog to manage sessions.
 """
 
-from PyQt6.QtCore import pyqtSlot, Qt, QFileInfo
+import datetime
+import pathlib
+
+from PyQt6.QtCore import pyqtSlot, Qt
 from PyQt6.QtGui import QPalette
 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem
 
@@ -59,8 +62,9 @@
         for session in sessions:
             itm = QTreeWidgetItem()
             itm.setText(0, session.name)
-            itm.setText(1, QFileInfo(session.filePath).lastModified()
-                        .toString("yyyy-MM-dd hh:mm"))
+            itm.setText(1, datetime.datetime.fromtimestamp(
+                pathlib.Path(session.filePath).stat().st_mtime)
+                .isoformat(sep=" ", timespec="minutes"))
             itm.setData(0, SessionManagerDialog.SessionFileRole,
                         session.filePath)
             itm.setData(0, SessionManagerDialog.BackupSessionRole,
@@ -155,7 +159,7 @@
         """
         headerWidth = self.sessionsList.header().width()
         self.sessionsList.header().resizeSection(
-            0, headerWidth - headerWidth / 2.5)
+            0, int(headerWidth - headerWidth / 2.5))
     
     @pyqtSlot()
     def __newSession(self):
--- a/eric7/WebBrowser/Sync/DirectorySyncHandler.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/Sync/DirectorySyncHandler.py	Fri Jun 17 16:36:14 2022 +0200
@@ -8,8 +8,9 @@
 """
 
 import os
+import pathlib
 
-from PyQt6.QtCore import pyqtSignal, QByteArray, QFileInfo, QCoreApplication
+from PyQt6.QtCore import pyqtSignal, QByteArray, QCoreApplication
 
 from .SyncHandler import SyncHandler
 
@@ -156,15 +157,16 @@
             os.path.exists(os.path.join(
                 Preferences.getWebBrowser("SyncDirectoryPath"),
                 self._remoteFiles[type_])) and
-            QFileInfo(fileName).lastModified() <= QFileInfo(
+            pathlib.Path(fileName).stat().st_mtime <= pathlib.Path(
                 os.path.join(Preferences.getWebBrowser("SyncDirectoryPath"),
-                             self._remoteFiles[type_])).lastModified()
+                             self._remoteFiles[type_])).stat().st_mtime
         ):
             self.__downloadFile(
                 type_, fileName,
-                QFileInfo(os.path.join(
+                int(pathlib.Path(os.path.join(
                     Preferences.getWebBrowser("SyncDirectoryPath"),
-                    self._remoteFiles[type_])).lastModified().toTime_t())
+                    self._remoteFiles[type_])).stat().st_mtime)
+            )
         else:
             if not os.path.exists(os.path.join(
                     Preferences.getWebBrowser("SyncDirectoryPath"),
--- a/eric7/WebBrowser/Sync/FtpSyncHandler.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/Sync/FtpSyncHandler.py	Fri Jun 17 16:36:14 2022 +0200
@@ -10,10 +10,9 @@
 import ftplib           # secok
 import io
 import contextlib
+import pathlib
 
-from PyQt6.QtCore import (
-    pyqtSignal, QTimer, QFileInfo, QCoreApplication, QByteArray
-)
+from PyQt6.QtCore import pyqtSignal, QTimer, QCoreApplication, QByteArray
 
 from EricNetwork.EricFtp import EricFtp, EricFtpProxyType, EricFtpProxyError
 
@@ -262,8 +261,9 @@
             self._remoteFiles[type_] in self.__remoteFilesFound
         ):
             if (
-                QFileInfo(fileName).lastModified() <
-                self.__remoteFilesFound[self._remoteFiles[type_]]
+                pathlib.Path(fileName).stat().st_mtime <
+                self.__remoteFilesFound[
+                    self._remoteFiles[type_].toSecsSinceEpoch()]
             ):
                 self.__downloadFile(
                     type_, fileName,
--- a/eric7/WebBrowser/WebBrowserView.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/WebBrowserView.py	Fri Jun 17 16:36:14 2022 +0200
@@ -11,10 +11,11 @@
 import os
 import functools
 import contextlib
+import pathlib
 
 from PyQt6.QtCore import (
-    pyqtSignal, pyqtSlot, Qt, QUrl, QFileInfo, QTimer, QEvent, QPoint,
-    QPointF, QDateTime, QStandardPaths, QByteArray, QIODevice, QDataStream
+    pyqtSignal, pyqtSlot, Qt, QUrl, QTimer, QEvent, QPoint, QPointF, QDateTime,
+    QStandardPaths, QByteArray, QIODevice, QDataStream
 )
 from PyQt6.QtGui import (
     QDesktopServices, QClipboard, QIcon, QContextMenuEvent, QPixmap, QCursor
@@ -248,7 +249,7 @@
                 # it is a local path on win os
                 name = QUrl.fromLocalFile(name.toString())
             
-            if not QFileInfo(name.toLocalFile()).exists():
+            if not pathlib.Path(name.toLocalFile()).exists():
                 EricMessageBox.critical(
                     self,
                     self.tr("eric Web Browser"),
--- a/eric7/WebBrowser/WebBrowserWindow.py	Thu Jun 16 18:28:59 2022 +0200
+++ b/eric7/WebBrowser/WebBrowserWindow.py	Fri Jun 17 16:36:14 2022 +0200
@@ -11,10 +11,11 @@
 import shutil
 import functools
 import contextlib
+import pathlib
 
 from PyQt6.QtCore import (
     pyqtSlot, pyqtSignal, Qt, QByteArray, QSize, QTimer, QUrl, QProcess,
-    QEvent, QFileInfo
+    QEvent
 )
 from PyQt6.QtGui import (
     QDesktopServices, QKeySequence, QAction, QFont, QFontMetrics
@@ -5048,19 +5049,19 @@
         if not fn:
             return
         
-        ext = QFileInfo(fn).suffix()
-        if not ext:
+        fpath = pathlib.Path(fn)
+        if not fpath.suffix:
             ex = selectedFilter.split("(*")[1].split(")")[0]
             if ex:
-                fn += ex
+                fpath = fpath.with_suffix(ex)
         
         ok = (
             EricMessageBox.yesNo(
                 self,
                 self.tr("Export Keyboard Shortcuts"),
                 self.tr("""<p>The keyboard shortcuts file <b>{0}</b> exists"""
-                        """ already. Overwrite it?</p>""").format(fn))
-            if os.path.exists(fn) else
+                        """ already. Overwrite it?</p>""").format(fpath))
+            if fpath.exists() else
             True
         )
         

eric ide

mercurial