Merge #14350: Add WalletLocation class
65f3672f3bwallet: Refactor to use WalletLocation (João Barbosa)01a4c095c8wallet: Add WalletLocation utility class (João Barbosa) Pull request description: Advantages of this change: - avoid resolving wallet absolute path and name repetitively and in multiple places; - avoid calling `GetWalletDir` in multiple places; - extract these details from the actual wallet implementation. The `WalletLocation` class can be a way to represent a wallet not yet loaded that exists in the wallet directory. Tree-SHA512: 71ec09786e038499710e7acafe92d66ab9883fc894964e267443ae9c10a6872a10995c3987a169c436a4e793dae96b28fb97bd7f78483c4b72ac930fa23f8686
This commit is contained in:
@@ -80,3 +80,14 @@ std::vector<fs::path> ListWalletDir()
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
WalletLocation::WalletLocation(const std::string& name)
|
||||
: m_name(name)
|
||||
, m_path(fs::absolute(name, GetWalletDir()))
|
||||
{
|
||||
}
|
||||
|
||||
bool WalletLocation::Exists() const
|
||||
{
|
||||
return fs::symlink_status(m_path).type() != fs::file_not_found;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user