mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Use ArgsManager::GetPathArg() for "-datadir" option
This commit is contained in:
parent
540ca5111f
commit
15b632bf16
2 changed files with 5 additions and 5 deletions
|
@ -1150,7 +1150,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
|
||||
|
||||
// Warn about relative -datadir path.
|
||||
if (args.IsArgSet("-datadir") && !fs::PathFromString(args.GetArg("-datadir", "")).is_absolute()) {
|
||||
if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) {
|
||||
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
|
||||
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
|
||||
"from a different location, it will be unable to locate the current data files. There could "
|
||||
|
|
|
@ -440,9 +440,9 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
|
|||
// this function
|
||||
if (!path.empty()) return path;
|
||||
|
||||
std::string datadir = GetArg("-datadir", "");
|
||||
const fs::path datadir{GetPathArg("-datadir")};
|
||||
if (!datadir.empty()) {
|
||||
path = fs::absolute(StripRedundantLastElementsOfPath(fs::PathFromString(datadir)));
|
||||
path = fs::absolute(datadir);
|
||||
if (!fs::is_directory(path)) {
|
||||
path = "";
|
||||
return path;
|
||||
|
@ -823,8 +823,8 @@ fs::path GetDefaultDataDir()
|
|||
|
||||
bool CheckDataDirOption()
|
||||
{
|
||||
std::string datadir = gArgs.GetArg("-datadir", "");
|
||||
return datadir.empty() || fs::is_directory(fs::absolute(fs::PathFromString(datadir)));
|
||||
const fs::path datadir{gArgs.GetPathArg("-datadir")};
|
||||
return datadir.empty() || fs::is_directory(fs::absolute(datadir));
|
||||
}
|
||||
|
||||
fs::path GetConfigFile(const std::string& confPath)
|
||||
|
|
Loading…
Add table
Reference in a new issue