aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoind.cpp
diff options
context:
space:
mode:
authorPavel Janík <Pavel@Janik.cz>2014-11-22 19:56:25 +0100
committerPavel Janík <Pavel@Janik.cz>2014-11-22 20:46:11 +0100
commit3d0a1ce193a7f94862027de6df24cad7ce659256 (patch)
treee60486e11e9fae20c140a1b6169adf8b03ca17b9 /src/bitcoind.cpp
parenta574189e2acdaa03658bfe495740b2d722984467 (diff)
downloadbitcoin-3d0a1ce193a7f94862027de6df24cad7ce659256.tar.xz
Process help and version arguments before datadir.
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r--src/bitcoind.cpp53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index a79e581a80..be7757b0b6 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -59,13 +59,36 @@ bool AppInit(int argc, char* argv[])
boost::thread* detectShutdownThread = NULL;
bool fRet = false;
+
+ //
+ // Parameters
+ //
+ // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
+ ParseParameters(argc, argv);
+
+ // Process help and version before taking care about datadir
+ if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version"))
+ {
+ std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";
+
+ if (mapArgs.count("-version"))
+ {
+ strUsage += LicenseInfo();
+ }
+ else
+ {
+ strUsage += "\n" + _("Usage:") + "\n" +
+ " bitcoind [options] " + _("Start Bitcoin Core Daemon") + "\n";
+
+ strUsage += "\n" + HelpMessage(HMM_BITCOIND);
+ }
+
+ fprintf(stdout, "%s", strUsage.c_str());
+ return false;
+ }
+
try
{
- //
- // Parameters
- //
- // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
- ParseParameters(argc, argv);
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
@@ -84,26 +107,6 @@ bool AppInit(int argc, char* argv[])
return false;
}
- if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version"))
- {
- std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n";
-
- if (mapArgs.count("-version"))
- {
- strUsage += LicenseInfo();
- }
- else
- {
- strUsage += "\n" + _("Usage:") + "\n" +
- " bitcoind [options] " + _("Start Bitcoin Core Daemon") + "\n";
-
- strUsage += "\n" + HelpMessage(HMM_BITCOIND);
- }
-
- fprintf(stdout, "%s", strUsage.c_str());
- return false;
- }
-
// Command-line RPC
bool fCommandLine = false;
for (int i = 1; i < argc; i++)