diff options
author | shannon1916 <shannon@unita.network> | 2019-05-19 16:43:22 +0800 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-06-07 11:11:56 +0200 |
commit | b55cbe82d98338c3c63770d624bda64cb0f472b9 (patch) | |
tree | 0809f61a8610df6564b746d69cd3f8883aac2315 | |
parent | b6c1f9478f52b01f0858c402b3e73761f83e4fc6 (diff) | |
download | bitcoin-b55cbe82d98338c3c63770d624bda64cb0f472b9.tar.xz |
qt: fix opening bitcoin.conf via Preferences on macOS; see #15409
Github-Pull: #16044
Rebased-From: 6e6494b3fb345848025494cb7a79c5bf8f35e417
-rw-r--r-- | src/qt/guiutil.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index ba0a5abdf3..f6dba1006b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -60,6 +60,7 @@ #include <objc/objc-runtime.h> #include <CoreServices/CoreServices.h> +#include <QProcess> #endif namespace GUIUtil { @@ -392,7 +393,15 @@ bool openBitcoinConf() configFile.close(); /* Open bitcoin.conf with the associated application */ - return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); + bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); +#ifdef Q_OS_MAC + // Workaround for macOS-specific behavior; see #15409. + if (!res) { + res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", boostPathToQString(pathConfig)}); + } +#endif + + return res; } ToolTipToRichTextFilter::ToolTipToRichTextFilter(int _size_threshold, QObject *parent) : |