aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKiminuo <kiminuo@protonmail.com>2021-02-26 09:52:50 +0100
committerKiminuo <kiminuo@protonmail.com>2021-04-18 12:07:00 +0200
commitbb8d1c6e029a2fd01387599d2ff3bfc879a8ada5 (patch)
tree1b34f491137be9ef3f9bd5b78f471db0d975e8cc /src
parentb4190eff72c00e384ad238f9c2f10c8b91be969b (diff)
Change ClearDataDirPathCache() to ArgsManager.ClearPathCache().
Diffstat (limited to 'src')
-rw-r--r--src/test/util/setup_common.cpp2
-rw-r--r--src/test/util_tests.cpp8
-rw-r--r--src/util/system.cpp9
-rw-r--r--src/util/system.h6
4 files changed, 9 insertions, 16 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index 831083ccb8..ffc5115145 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -90,7 +90,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName, const std::ve
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
index 92e17d7117..04b908829b 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -56,19 +56,19 @@ BOOST_AUTO_TEST_CASE(util_datadir)
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.cpp b/src/util/system.cpp
index 474c4893f9..9b3bd46b38 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -445,7 +445,7 @@ const fs::path& ArgsManager::GetDataDirPath(bool net_specific) const
return path;
}
-void ArgsManager::ClearDatadirPathCache()
+void ArgsManager::ClearPathCache()
{
LOCK(cs_args);
@@ -813,11 +813,6 @@ bool CheckDataDirOption()
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);
@@ -976,7 +971,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
}
// If datadir is changed in .conf file:
- ClearDatadirCache();
+ gArgs.ClearPathCache();
if (!CheckDataDirOption()) {
error = strprintf("specified data directory \"%s\" does not exist.", GetArg("-datadir", ""));
return false;
diff --git a/src/util/system.h b/src/util/system.h
index fcdb04bb8d..61f862c93a 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -94,8 +94,6 @@ fs::path GetDefaultDataDir();
const fs::path &GetDataDir(bool fNetSpecific = true);
// 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);
@@ -281,9 +279,9 @@ public:
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