Changeset View
Changeset View
Standalone View
Standalone View
src/bitcoind.cpp
| Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | bool AppInit(int argc, char *argv[]) { | ||||
| // | // | ||||
| // Parameters | // Parameters | ||||
| // | // | ||||
| // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's | // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's | ||||
| // main() | // main() | ||||
| gArgs.ParseParameters(argc, argv); | gArgs.ParseParameters(argc, argv); | ||||
| // Process help and version before taking care about datadir | // Process help and version before taking care about datadir | ||||
| if (gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || | if (gArgs.IsHelpSet()) { | ||||
| gArgs.IsArgSet("-help") || gArgs.IsArgSet("-version")) { | |||||
| std::string strUsage = strprintf(_("%s Daemon"), _(PACKAGE_NAME)) + | std::string strUsage = strprintf(_("%s Daemon"), _(PACKAGE_NAME)) + | ||||
| " " + _("version") + " " + FormatFullVersion() + | " " + _("version") + " " + FormatFullVersion() + | ||||
| "\n"; | "\n"; | ||||
| if (gArgs.IsArgSet("-version")) { | if (gArgs.IsVersionSet()) { | ||||
| strUsage += FormatParagraph(LicenseInfo()); | strUsage += FormatParagraph(LicenseInfo()); | ||||
| } else { | } else { | ||||
| strUsage += "\n" + _("Usage:") + "\n" + | strUsage += "\n" + _("Usage:") + "\n" + | ||||
| " bitcoind [options] " + | " bitcoind [options] " + | ||||
| strprintf(_("Start %s Daemon"), _(PACKAGE_NAME)) + "\n"; | strprintf(_("Start %s Daemon"), _(PACKAGE_NAME)) + "\n"; | ||||
| strUsage += "\n" + HelpMessage(HMM_BITCOIND); | strUsage += "\n" + HelpMessage(HMM_BITCOIND); | ||||
| } | } | ||||
| fprintf(stdout, "%s", strUsage.c_str()); | fprintf(stdout, "%s", strUsage.c_str()); | ||||
| return true; | return true; | ||||
| } | } | ||||
| try { | try { | ||||
| if (!fs::is_directory(GetDataDir(false))) { | if (!fs::is_directory(GetDataDir(false))) { | ||||
| fprintf(stderr, | fprintf(stderr, | ||||
| "Error: Specified data directory \"%s\" does not exist.\n", | "Error: Specified data directory \"%s\" does not exist.\n", | ||||
| gArgs.GetArg("-datadir", "").c_str()); | gArgs.GetDataDir().c_str()); | ||||
| return false; | return false; | ||||
| } | } | ||||
| try { | try { | ||||
| gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); | gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); | ||||
| } catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
| fprintf(stderr, "Error reading configuration file: %s\n", e.what()); | fprintf(stderr, "Error reading configuration file: %s\n", e.what()); | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines | |||||