--- 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): """