aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorAlexander Leishman <leishman3@gmail.com>2018-08-24 15:03:01 -0700
committerAlexander Leishman <leishman3@gmail.com>2018-08-30 11:24:03 -0700
commit946107a68ffce8c586f9f1657fd7d67d075c321e (patch)
tree0a4d0b4d7fc4b041f9e603a16a40524569a2d174 /src/init.cpp
parent07033a8f91975028e366920b0da3f7e2a6ef9cbd (diff)
Only log "Using PATH_TO_bitcoin.conf" message on startup if conf file exists.
Currently we log a message indicating that a bitcoin.conf file is being used even if one does not exists. This commit changes the logic to only display this message if a config file exists and logs a separate message if no config file exists. Additionally, a warning is now logged if the file path passed in the -conf flag does not exist.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index bd330459f6..d4833f029c 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1243,7 +1243,19 @@ bool AppInitMain()
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());
LogPrintf("Using data directory %s\n", GetDataDir().string());
- LogPrintf("Using config file %s\n", GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string());
+
+ // Only log conf file usage message if conf file actually exists.
+ fs::path config_file_path = GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
+ if (fs::exists(config_file_path)) {
+ LogPrintf("Config file: %s\n", config_file_path.string());
+ } else if (gArgs.IsArgSet("-conf")) {
+ // Warn if no conf file exists at path provided by user
+ InitWarning(strprintf(_("The specified config file %s does not exist\n"), config_file_path.string()));
+ } else {
+ // Not categorizing as "Warning" because it's the default behavior
+ LogPrintf("Config file: %s (not found, skipping)\n", config_file_path.string());
+ }
+
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
// Warn about relative -datadir path.