Skip to content

Commit bb8d1c6

Browse files
committed
Change ClearDataDirPathCache() to ArgsManager.ClearPathCache().
1 parent b4190ef commit bb8d1c6

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

src/test/util/setup_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
9090
fs::create_directories(m_path_root);
9191
m_args.ForceSetArg("-datadir", m_path_root.string());
9292
gArgs.ForceSetArg("-datadir", m_path_root.string());
93-
ClearDatadirCache();
93+
gArgs.ClearPathCache();
9494
{
9595
SetupServerArgs(m_node);
9696
std::string error;

src/test/util_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ BOOST_AUTO_TEST_CASE(util_datadir)
5656
const fs::path dd_norm = args.GetDataDirPath();
5757

5858
args.ForceSetArg("-datadir", dd_norm.string() + "/");
59-
ClearDatadirCache();
59+
args.ClearPathCache();
6060
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
6161

6262
args.ForceSetArg("-datadir", dd_norm.string() + "/.");
63-
ClearDatadirCache();
63+
args.ClearPathCache();
6464
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
6565

6666
args.ForceSetArg("-datadir", dd_norm.string() + "/./");
67-
ClearDatadirCache();
67+
args.ClearPathCache();
6868
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
6969

7070
args.ForceSetArg("-datadir", dd_norm.string() + "/.//");
71-
ClearDatadirCache();
71+
args.ClearPathCache();
7272
BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath());
7373
}
7474

src/util/system.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ const fs::path& ArgsManager::GetDataDirPath(bool net_specific) const
445445
return path;
446446
}
447447

448-
void ArgsManager::ClearDatadirPathCache()
448+
void ArgsManager::ClearPathCache()
449449
{
450450
LOCK(cs_args);
451451

@@ -813,11 +813,6 @@ bool CheckDataDirOption()
813813
return datadir.empty() || fs::is_directory(fs::system_complete(datadir));
814814
}
815815

816-
void ClearDatadirCache()
817-
{
818-
gArgs.ClearDatadirPathCache();
819-
}
820-
821816
fs::path GetConfigFile(const std::string& confPath)
822817
{
823818
return AbsPathForConfigVal(fs::path(confPath), false);
@@ -976,7 +971,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
976971
}
977972

978973
// If datadir is changed in .conf file:
979-
ClearDatadirCache();
974+
gArgs.ClearPathCache();
980975
if (!CheckDataDirOption()) {
981976
error = strprintf("specified data directory \"%s\" does not exist.", GetArg("-datadir", ""));
982977
return false;

src/util/system.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ fs::path GetDefaultDataDir();
9494
const fs::path &GetDataDir(bool fNetSpecific = true);
9595
// Return true if -datadir option points to a valid directory or is not specified.
9696
bool CheckDataDirOption();
97-
/** Tests only */
98-
void ClearDatadirCache();
9997
fs::path GetConfigFile(const std::string& confPath);
10098
#ifdef WIN32
10199
fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
@@ -281,9 +279,9 @@ class ArgsManager
281279
const fs::path& GetDataDirPath(bool net_specific = true) const;
282280

283281
/**
284-
* For testing
282+
* Clear cached directory paths
285283
*/
286-
void ClearDatadirPathCache();
284+
void ClearPathCache();
287285

288286
/**
289287
* Return a vector of strings of the given argument

0 commit comments

Comments
 (0)