mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +02:00
Use ArgsManager::GetPathArg() for "-datadir" option
This commit is contained in:
parent
540ca5111f
commit
15b632bf16
@ -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);
|
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
|
||||||
|
|
||||||
// Warn about relative -datadir path.
|
// 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 */
|
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 "
|
"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 "
|
"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
|
// this function
|
||||||
if (!path.empty()) return path;
|
if (!path.empty()) return path;
|
||||||
|
|
||||||
std::string datadir = GetArg("-datadir", "");
|
const fs::path datadir{GetPathArg("-datadir")};
|
||||||
if (!datadir.empty()) {
|
if (!datadir.empty()) {
|
||||||
path = fs::absolute(StripRedundantLastElementsOfPath(fs::PathFromString(datadir)));
|
path = fs::absolute(datadir);
|
||||||
if (!fs::is_directory(path)) {
|
if (!fs::is_directory(path)) {
|
||||||
path = "";
|
path = "";
|
||||||
return path;
|
return path;
|
||||||
@ -823,8 +823,8 @@ fs::path GetDefaultDataDir()
|
|||||||
|
|
||||||
bool CheckDataDirOption()
|
bool CheckDataDirOption()
|
||||||
{
|
{
|
||||||
std::string datadir = gArgs.GetArg("-datadir", "");
|
const fs::path datadir{gArgs.GetPathArg("-datadir")};
|
||||||
return datadir.empty() || fs::is_directory(fs::absolute(fs::PathFromString(datadir)));
|
return datadir.empty() || fs::is_directory(fs::absolute(datadir));
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::path GetConfigFile(const std::string& confPath)
|
fs::path GetConfigFile(const std::string& confPath)
|
||||||
|
Loading…
Reference in New Issue
Block a user