mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
util: Add ArgsManager::GetPathArg() function
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
parent
5e8e0b3d7f
commit
540ca5111f
3 changed files with 109 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue