Skip to content

Commit 6e6494b

Browse files
committed
qt: fix opening bitcoin.conf via Preferences on macOS; see bitcoin#15409
1 parent 387eb5b commit 6e6494b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/qt/guiutil.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
#include <objc/objc-runtime.h>
6262
#include <CoreServices/CoreServices.h>
63+
#include <QProcess>
6364
#endif
6465

6566
namespace GUIUtil {
@@ -399,7 +400,15 @@ bool openBitcoinConf()
399400
configFile.close();
400401

401402
/* Open bitcoin.conf with the associated application */
402-
return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig)));
403+
bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig)));
404+
#ifdef Q_OS_MAC
405+
// Workaround for macOS-specific behavior; see #15409.
406+
if (!res) {
407+
res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", boostPathToQString(pathConfig)});
408+
}
409+
#endif
410+
411+
return res;
403412
}
404413

405414
ToolTipToRichTextFilter::ToolTipToRichTextFilter(int _size_threshold, QObject *parent) :

0 commit comments

Comments
 (0)