diff -r 8c5296fe3056 -r 8a68afaf1ba2 eric7/QScintilla/Exporters/ExporterBase.py --- a/eric7/QScintilla/Exporters/ExporterBase.py Wed Jun 15 09:44:07 2022 +0200 +++ b/eric7/QScintilla/Exporters/ExporterBase.py Thu Jun 16 18:28:59 2022 +0200 @@ -7,12 +7,12 @@ Module implementing the exporter base class. """ -from PyQt6.QtCore import QFileInfo, QObject, QCoreApplication +import pathlib + +from PyQt6.QtCore import QObject, QCoreApplication from EricWidgets import EricMessageBox, EricFileDialog -import Utilities - class ExporterBase(QObject): """ @@ -47,12 +47,12 @@ EricFileDialog.DontConfirmOverwrite) if fn: - 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 - if QFileInfo(fn).exists(): + fpath = fpath.with_suffix(ex) + if fpath.exists(): res = EricMessageBox.yesNo( self.editor, QCoreApplication.translate( @@ -60,14 +60,12 @@ QCoreApplication.translate( 'Exporter', "<p>The file <b>{0}</b> already exists." - " Overwrite it?</p>").format(fn), + " Overwrite it?</p>").format(str(fpath)), icon=EricMessageBox.Warning) if not res: return "" - - fn = Utilities.toNativeSeparators(fn) - return fn + return str(fpath) def exportSource(self): """