aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r--src/util/system.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 9b3bd46b38..5b87806a45 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -366,14 +366,12 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
}
// we do not allow -includeconf from command line
- bool success = true;
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
- for (const auto& include : util::SettingsSpan(*includes)) {
- error += "-includeconf cannot be used from commandline; -includeconf=" + include.get_str() + "\n";
- success = false;
- }
+ const auto& include{*util::SettingsSpan(*includes).begin()}; // pick first value as example
+ error = "-includeconf cannot be used from commandline; -includeconf=" + include.write();
+ return false;
}
- return success;
+ return true;
}
std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const
@@ -388,7 +386,7 @@ std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) co
return std::nullopt;
}
-const fs::path& ArgsManager::GetBlocksDirPath()
+const fs::path& ArgsManager::GetBlocksDirPath() const
{
LOCK(cs_args);
fs::path& path = m_cached_blocks_path;
@@ -404,7 +402,7 @@ const fs::path& ArgsManager::GetBlocksDirPath()
return path;
}
} else {
- path = GetDataDirPath(false);
+ path = GetDataDirBase();
}
path /= BaseParams().DataDir();
@@ -414,7 +412,7 @@ const fs::path& ArgsManager::GetBlocksDirPath()
return path;
}
-const fs::path& ArgsManager::GetDataDirPath(bool net_specific) const
+const fs::path& ArgsManager::GetDataDir(bool net_specific) const
{
LOCK(cs_args);
fs::path& path = net_specific ? m_cached_network_datadir_path : m_cached_datadir_path;
@@ -513,7 +511,7 @@ bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const
}
if (filepath) {
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;
}
@@ -802,11 +800,6 @@ fs::path GetDefaultDataDir()
#endif
}
-const fs::path &GetDataDir(bool fNetSpecific)
-{
- return gArgs.GetDataDirPath(fNetSpecific);
-}
-
bool CheckDataDirOption()
{
std::string datadir = gArgs.GetArg("-datadir", "");
@@ -1361,7 +1354,7 @@ fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific)
if (path.is_absolute()) {
return path;
}
- return fsbridge::AbsPathJoin(GetDataDir(net_specific), path);
+ return fsbridge::AbsPathJoin(net_specific ? gArgs.GetDataDirNet() : gArgs.GetDataDirBase(), path);
}
void ScheduleBatchPriority()