mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Add CheckDataDirOption() function
This commit is contained in:
@@ -741,8 +741,9 @@ const fs::path &GetDataDir(bool fNetSpecific)
|
||||
// this function
|
||||
if (!path.empty()) return path;
|
||||
|
||||
if (gArgs.IsArgSet("-datadir")) {
|
||||
path = fs::system_complete(gArgs.GetArg("-datadir", ""));
|
||||
std::string datadir = gArgs.GetArg("-datadir", "");
|
||||
if (!datadir.empty()) {
|
||||
path = fs::system_complete(datadir);
|
||||
if (!fs::is_directory(path)) {
|
||||
path = "";
|
||||
return path;
|
||||
@@ -761,6 +762,12 @@ const fs::path &GetDataDir(bool fNetSpecific)
|
||||
return path;
|
||||
}
|
||||
|
||||
bool CheckDataDirOption()
|
||||
{
|
||||
std::string datadir = gArgs.GetArg("-datadir", "");
|
||||
return datadir.empty() || fs::is_directory(fs::system_complete(datadir));
|
||||
}
|
||||
|
||||
void ClearDatadirCache()
|
||||
{
|
||||
LOCK(csPathCached);
|
||||
|
||||
Reference in New Issue
Block a user