mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-17 11:00:44 +01:00
util: Add ArgsManager::GetPathArg() function
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
@@ -399,6 +399,13 @@ std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) co
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
fs::path ArgsManager::GetPathArg(std::string pathlike_arg) const
|
||||
{
|
||||
auto result = fs::PathFromString(GetArg(pathlike_arg, "")).lexically_normal();
|
||||
// Remove trailing slash, if present.
|
||||
return result.has_filename() ? result : result.parent_path();
|
||||
}
|
||||
|
||||
const fs::path& ArgsManager::GetBlocksDirPath() const
|
||||
{
|
||||
LOCK(cs_args);
|
||||
|
||||
Reference in New Issue
Block a user