I thought through the initialization order a bit. Fixes at least #3478. @diapolo can you please help testing?
Splits and documents the phases:
- Parse command-line options. These take precedence over anything else.
- Basic Qt initialization (not dependent on parameters or configuration)
- Application identification
- Initialization of translations
- Now that settings and translations are available, ask user for data directory
- Determine availability of data directory and parse bitcoin.conf
- URI IPC sending
- Main GUI initialization
Splits command line parsing logic from ipcSendCommandLine into ipcParseCommandLine, as isTestNet() can only be overridden in the early stages before choosing a data directory. Sending however needs to happen after choosing a data directory.
Tested:
- URI handling to running testnet and mainnet instances
- URI handling with custom data directories
- URI handling for testnet URIs launches testnet GUI
-choosedatadircan be used to provide custom data directories