mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Add ArgsManager.GetDataDirBase()
and ArgsManager.GetDataDirNet()
as an intended replacement for ArgsManager.GetDataDirPath(net_identifier)
This commit is contained in:
parent
716de29dd8
commit
0f53df47d5
2 changed files with 21 additions and 5 deletions
|
@ -404,7 +404,7 @@ const fs::path& ArgsManager::GetBlocksDirPath() const
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
path = GetDataDirPath(false);
|
path = GetDataDirBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
path /= BaseParams().DataDir();
|
path /= BaseParams().DataDir();
|
||||||
|
@ -513,7 +513,7 @@ bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const
|
||||||
}
|
}
|
||||||
if (filepath) {
|
if (filepath) {
|
||||||
std::string settings = GetArg("-settings", BITCOIN_SETTINGS_FILENAME);
|
std::string settings = GetArg("-settings", BITCOIN_SETTINGS_FILENAME);
|
||||||
*filepath = fsbridge::AbsPathJoin(GetDataDirPath(/* net_specific= */ true), temp ? settings + ".tmp" : settings);
|
*filepath = fsbridge::AbsPathJoin(GetDataDirNet(), temp ? settings + ".tmp" : settings);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ fs::path GetDefaultDataDir()
|
||||||
|
|
||||||
const fs::path &GetDataDir(bool fNetSpecific)
|
const fs::path &GetDataDir(bool fNetSpecific)
|
||||||
{
|
{
|
||||||
return gArgs.GetDataDirPath(fNetSpecific);
|
return fNetSpecific ? gArgs.GetDataDirNet() : gArgs.GetDataDirBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckDataDirOption()
|
bool CheckDataDirOption()
|
||||||
|
@ -1361,7 +1361,7 @@ fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific)
|
||||||
if (path.is_absolute()) {
|
if (path.is_absolute()) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
return fsbridge::AbsPathJoin(GetDataDir(net_specific), path);
|
return fsbridge::AbsPathJoin(net_specific ? gArgs.GetDataDirNet() : gArgs.GetDataDirBase(), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScheduleBatchPriority()
|
void ScheduleBatchPriority()
|
||||||
|
|
|
@ -119,7 +119,7 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string&
|
||||||
* the datadir if they are not absolute.
|
* the datadir if they are not absolute.
|
||||||
*
|
*
|
||||||
* @param path The path to be conditionally prefixed with datadir.
|
* @param path The path to be conditionally prefixed with datadir.
|
||||||
* @param net_specific Forwarded to GetDataDir().
|
* @param net_specific Use network specific datadir variant
|
||||||
* @return The normalized path.
|
* @return The normalized path.
|
||||||
*/
|
*/
|
||||||
fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true);
|
fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true);
|
||||||
|
@ -268,6 +268,22 @@ public:
|
||||||
*/
|
*/
|
||||||
const fs::path& GetBlocksDirPath() const;
|
const fs::path& GetBlocksDirPath() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data directory path
|
||||||
|
*
|
||||||
|
* @return Absolute path on success, otherwise an empty path when a non-directory path would be returned
|
||||||
|
* @post Returned directory path is created unless it is empty
|
||||||
|
*/
|
||||||
|
const fs::path& GetDataDirBase() const { return GetDataDirPath(false); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data directory path with appended network identifier
|
||||||
|
*
|
||||||
|
* @return Absolute path on success, otherwise an empty path when a non-directory path would be returned
|
||||||
|
* @post Returned directory path is created unless it is empty
|
||||||
|
*/
|
||||||
|
const fs::path& GetDataDirNet() const { return GetDataDirPath(true); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data directory path
|
* Get data directory path
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue