This is based on #27302. The non-base commits are:
ae5fc323b24
bitcoin-wallet: make bitcoin-wallet tool load config fileb091d9b0762
init: Allow bitcoin default datadir to point at an external datadir5855150efae
Make GUI and CLI tools use the same datadir
Currently if your choose a non-default datadir in the GUI intro screen, the datadir is ignored by CLI tools.
This PR makes GUI and CLI tools the same datadir setting by default. It is followup to https://github.com/bitcoin-core/gui/pull/602 which made GUI and CLI tools use the same settings as long as they loaded the same datadir.
The reason GUI and CLI tools use inconsistent datadirs is that GUI stores the datadir path in a strDataDir
field in .config/Bitcoin/Bitcoin-Qt.conf
1 which CLI tools ignore. This PR changes the GUI to instead store the datadir path at the default datadir location ~/.bitcoin
2 as a symlink that CLI tools will already follow, or as a text file if the filesystem does not support symlinks.
If upgrading from a previous version of the GUI and there is only a GUI datadir, the strDataDir
setting will be automatically migrated to a symlink so CLI tools will start using it as well.
If upgrading and GUI and CLI tools are using different datadirs, the GUI will show a prompt allowing either of the datadirs to be loaded on startup, with an option to set one as the default going forward.