Fix the directory opened when exporting coding styles

On macOS. Make sure to use an absolute path for the file dialog.

Fixes: QTCREATORBUG-28832
Change-Id: I75f4166ee2bc3238a01089231bde4cf990269024
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Eike Ziller
2024-04-29 14:21:26 +02:00
parent 7a47cf0a11
commit ae4c893301

View File

@@ -216,9 +216,11 @@ void CodeStyleSelectorWidget::slotImportClicked()
void CodeStyleSelectorWidget::slotExportClicked() void CodeStyleSelectorWidget::slotExportClicked()
{ {
ICodeStylePreferences *currentPreferences = m_codeStyle->currentPreferences(); ICodeStylePreferences *currentPreferences = m_codeStyle->currentPreferences();
const FilePath filePath = FileUtils::getSaveFilePath(this, Tr::tr("Export Code Style"), const FilePath filePath = FileUtils::getSaveFilePath(
FilePath::fromString(QString::fromUtf8(currentPreferences->id() + ".xml")), this,
Tr::tr("Code styles (*.xml);;All files (*)")); Tr::tr("Export Code Style"),
FileUtils::homePath().pathAppended(QString::fromUtf8(currentPreferences->id() + ".xml")),
Tr::tr("Code styles (*.xml);;All files (*)"));
if (!filePath.isEmpty()) { if (!filePath.isEmpty()) {
CodeStylePool *codeStylePool = m_codeStyle->delegatingPool(); CodeStylePool *codeStylePool = m_codeStyle->delegatingPool();
codeStylePool->exportCodeStyle(filePath, currentPreferences); codeStylePool->exportCodeStyle(filePath, currentPreferences);