-
Notifications
You must be signed in to change notification settings - Fork 38.7k
qt: fix opening bitcoin.conf via Preferences on macOS #16044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What is |
|
Sorry. Since I find this bug initially in the Qtum blockchain, I wrote it wrong and have changed the text... |
|
The mentioned issue #15409 is related to the setting a default application to open
@shannon1916 your PR description could be edited using this GitHub tips ;) |
|
@hebasto The PR description is modified as you suggest. And, |
|
Concept ACK. Will test. |
|
tACK 57b30ce16cf6d4d2e6a30e70ede7f2bdd5fbc003 modulo nits (macOS 10.13.6) As my system already has a default app to open diff --git a/src/util/system.cpp b/src/util/system.cpp
index 6925bda4e..a5e24c0f3 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -72 +72 @@ const int64_t nStartupTime = GetTime();
-const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
+const char * const BITCOIN_CONF_FILENAME = "bitcoin.conftest"; |
|
@hebasto The default app for |
|
Too bad this required a MAC #ifdef and a fixed path to an executable. But I guess it's an acceptable fix. |
fanquake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
Have checked that this change works on macOS with and without a .conf file already in place.
In the later case a blank .conf is created and opened.
Will re-ack post comment fix-up and squash.
|
re-ACK 6e6494b |
|
tACK 6e6494b on macOS 10.14.x Using master (c7cfd20) you cannot open Using this PR (6e6494b): Opening an existing lldb Bitcoin-Qt.app -- -regtest
(lldb) target create "Bitcoin-Qt.app"
Current executable set to 'Bitcoin-Qt.app' (x86_64).
(lldb) settings set -- target.run-args "-regtest"
(lldb) run
Process 40791 launched: '/Users/michael/github/bitcoin/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt' (x86_64)
2019-06-03 10:00:00.852544-0400 Bitcoin-Qt[40791:8481788] MessageTracer: Falling back to default whitelist
2019-06-03 10:00:07.232235-0400 open[40799:8481923] MessageTracer: Falling back to default whitelist
2019-06-03 10:00:19.079914-0400 open[40928:8482455] MessageTracer: Falling back to default whitelist |
| #ifdef Q_OS_MAC | ||
| // Workaround for macOS-specific behavior; see #15409. | ||
| if (!res) { | ||
| res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", boostPathToQString(pathConfig)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just "open"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
high-sierra:~ hebasto$ /usr/bin/open
Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s <partial SDK name>][-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
By default, opens each file using the default application for that file.
If the file is in the form of a URL, the file will be opened as a URL.
Options:
-a Opens with the specified application.
-b Opens with the specified application bundle identifier.
-e Opens with TextEdit.
-t Opens with default text editor.
-f Reads input from standard input and opens with TextEdit.
-F --fresh Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
-R, --reveal Selects in the Finder instead of opening.
-W, --wait-apps Blocks until the used applications are closed (even if they were already running).
--args All remaining arguments are passed in argv to the application's main() function instead of opened.
-n, --new Open a new instance of the application even if one is already running.
-j, --hide Launches the app hidden.
-g, --background Does not bring the application to the foreground.
-h, --header Searches header file locations for headers matching the given filenames, and opens them.
-s For -h, the SDK to use; if supplied, only SDKs whose names contain the argument value are searched.
Otherwise the highest versioned SDK in each platform is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit path seems better, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is an OS specific hack, I think hardcoding the path seems fine, it's always that.
6e6494b qt: fix opening bitcoin.conf via Preferences on macOS; see #15409 (shannon1916) Pull request description: Fix #15409. The QT wallet fail to open the configuration file on Mac, when these is no default application for `*.conf` files. Here is a feasible way to solve this bug. When `QDesktopServices::openUrl` fails to open `file:///path/bitcoin.conf` with its default application, use `QProcess::startDetached` to run `open -t /path/bitcoin.conf` command instead, so as to open the configuration file with system's default text editor. ACKs for commit 6e6494: hebasto: re-ACK 6e6494b fanquake: tACK 6e6494b on macOS 10.14.x Tree-SHA512: 60e898f4cb77cfd7b8adbc8d33fbebf46bac2a801bdcf40cae15e24b78ad56b1f32358b1879b670623d9f8651dea93961d34269358cea18f4e15b089a8ffcfbf
|
Backported in #16035. |
Github-Pull: bitcoin#16044 Rebased-From: 6e6494b
Github-Pull: bitcoin#16044 Rebased-From: 6e6494b
Github-Pull: bitcoin#16044 Rebased-From: 6e6494b
a41da9f [QT] fix opening *.conf/log files on macOS when there is no default app to open them. (furszy) Pull request description: Built on top of #1515, only last commit counts for this. When MacOS has no default app to open *.conf and *.log throws an error instead of try to open them with a text editor. This PR solves the issue. Coming from btc@[16044](bitcoin#16044) ACKs for top commit: random-zebra: utACK a41da9f Fuzzbawls: utACK a41da9f Tree-SHA512: 5316e3a501576ed240cff9db32526eba7456112b8ad3024e5095a924a1da27f5ad5033fb3a4c50df305d262362e66abdffe2d17ff942895893e9889750dc8bf8
Summary: 6e6494b3fb345848025494cb7a79c5bf8f35e417 qt: fix opening bitcoin.conf via Preferences on macOS; see #15409 (shannon1916) Pull request description: Fix #15409. The QT wallet fail to open the configuration file on Mac, when these is no default application for `*.conf` files. Here is a feasible way to solve this bug. When `QDesktopServices::openUrl` fails to open `file:///path/bitcoin.conf` with its default application, use `QProcess::startDetached` to run `open -t /path/bitcoin.conf` command instead, so as to open the configuration file with system's default text editor. --- Backport of Core [[bitcoin/bitcoin#16044 | PR16044]] Test Plan: ninja all check check-functional I don't have a mac to test this unfortunately Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8665


Fix #15409. The QT wallet fail to open the configuration file on Mac, when these is no default application for
*.conffiles.Here is a feasible way to solve this bug. When
QDesktopServices::openUrlfails to openfile:///path/bitcoin.confwith its default application, useQProcess::startDetachedto runopen -t /path/bitcoin.confcommand instead, so as to open the configuration file with system's default text editor.