mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
refactor: Use new GetConfigFilePath function
New function was introduced by willcl-ark <will@256k1.dev> in commit
56e370fbb9 from
https://github.com/bitcoin/bitcoin/pull/27073 and removes some duplicate code.
This commit is contained in:
@@ -817,7 +817,7 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
|
|||||||
if (failedToGetAuthCookie) {
|
if (failedToGetAuthCookie) {
|
||||||
throw std::runtime_error(strprintf(
|
throw std::runtime_error(strprintf(
|
||||||
"Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (%s)",
|
"Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (%s)",
|
||||||
fs::PathToString(GetConfigFile(gArgs.GetPathArg("-conf", BITCOIN_CONF_FILENAME)))));
|
fs::PathToString(gArgs.GetConfigFilePath())));
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Authorization failed: Incorrect rpcuser or rpcpassword");
|
throw std::runtime_error("Authorization failed: Incorrect rpcuser or rpcpassword");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ bool StartLogging(const ArgsManager& args)
|
|||||||
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
|
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
|
||||||
|
|
||||||
// Only log conf file usage message if conf file actually exists.
|
// Only log conf file usage message if conf file actually exists.
|
||||||
fs::path config_file_path = GetConfigFile(args.GetPathArg("-conf", BITCOIN_CONF_FILENAME));
|
fs::path config_file_path = args.GetConfigFilePath();
|
||||||
if (fs::exists(config_file_path)) {
|
if (fs::exists(config_file_path)) {
|
||||||
LogPrintf("Config file: %s\n", fs::PathToString(config_file_path));
|
LogPrintf("Config file: %s\n", fs::PathToString(config_file_path));
|
||||||
} else if (args.IsArgSet("-conf")) {
|
} else if (args.IsArgSet("-conf")) {
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ void openDebugLogfile()
|
|||||||
|
|
||||||
bool openBitcoinConf()
|
bool openBitcoinConf()
|
||||||
{
|
{
|
||||||
fs::path pathConfig = GetConfigFile(gArgs.GetPathArg("-conf", BITCOIN_CONF_FILENAME));
|
fs::path pathConfig = gArgs.GetConfigFilePath();
|
||||||
|
|
||||||
/* Create the file */
|
/* Create the file */
|
||||||
std::ofstream configFile{pathConfig, std::ios_base::app};
|
std::ofstream configFile{pathConfig, std::ios_base::app};
|
||||||
|
|||||||
Reference in New Issue
Block a user