diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -110,7 +110,7 @@ fs::create_directories(m_path_root); m_args.ForceSetArg("-datadir", m_path_root.string()); gArgs.ForceSetArg("-datadir", m_path_root.string()); - ClearDatadirCache(); + gArgs.ClearPathCache(); { SetupServerArgs(m_node); std::string error; diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -55,19 +55,19 @@ const fs::path dd_norm = args.GetDataDirPath(); args.ForceSetArg("-datadir", dd_norm.string() + "/"); - ClearDatadirCache(); + args.ClearPathCache(); BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath()); args.ForceSetArg("-datadir", dd_norm.string() + "/."); - ClearDatadirCache(); + args.ClearPathCache(); BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath()); args.ForceSetArg("-datadir", dd_norm.string() + "/./"); - ClearDatadirCache(); + args.ClearPathCache(); BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath()); args.ForceSetArg("-datadir", dd_norm.string() + "/.//"); - ClearDatadirCache(); + args.ClearPathCache(); BOOST_CHECK_EQUAL(dd_norm, args.GetDataDirPath()); } diff --git a/src/util/system.h b/src/util/system.h --- a/src/util/system.h +++ b/src/util/system.h @@ -86,8 +86,6 @@ // Return true if -datadir option points to a valid directory or is not // specified. bool CheckDataDirOption(); -/** Tests only */ -void ClearDatadirCache(); fs::path GetConfigFile(const std::string &confPath); #ifdef WIN32 fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true); @@ -256,9 +254,9 @@ const fs::path &GetDataDirPath(bool net_specific = true) const; /** - * For testing + * Clear cached directory paths */ - void ClearDatadirPathCache(); + void ClearPathCache(); /** * Return a vector of strings of the given argument diff --git a/src/util/system.cpp b/src/util/system.cpp --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -461,7 +461,7 @@ return path; } -void ArgsManager::ClearDatadirPathCache() { +void ArgsManager::ClearPathCache() { LOCK(cs_args); m_cached_datadir_path = fs::path(); @@ -834,10 +834,6 @@ return datadir.empty() || fs::is_directory(fs::system_complete(datadir)); } -void ClearDatadirCache() { - gArgs.ClearDatadirPathCache(); -} - fs::path GetConfigFile(const std::string &confPath) { return AbsPathForConfigVal(fs::path(confPath), false); } @@ -1031,7 +1027,7 @@ } // If datadir is changed in .conf file: - ClearDatadirCache(); + gArgs.ClearPathCache(); if (!CheckDataDirOption()) { error = strprintf("specified data directory \"%s\" does not exist.", GetArg("-datadir", "").c_str());