mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
Wallet API: make sure path exists before searching for wallets
This commit is contained in:
parent
18e406a0e6
commit
fdef09f11c
@ -88,10 +88,13 @@ bool WalletManagerImpl::walletExists(const std::string &path)
|
|||||||
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path)
|
std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path)
|
||||||
{
|
{
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
|
boost::filesystem::path work_dir(path);
|
||||||
|
// return empty result if path doesn't exist
|
||||||
|
if(!boost::filesystem::is_directory(path)){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
const boost::regex wallet_rx("(.*)\\.(keys)$"); // searching for <wallet_name>.keys files
|
const boost::regex wallet_rx("(.*)\\.(keys)$"); // searching for <wallet_name>.keys files
|
||||||
boost::filesystem::recursive_directory_iterator end_itr; // Default ctor yields past-the-end
|
boost::filesystem::recursive_directory_iterator end_itr; // Default ctor yields past-the-end
|
||||||
boost::filesystem::path work_dir(path);
|
|
||||||
|
|
||||||
for (boost::filesystem::recursive_directory_iterator itr(path); itr != end_itr; ++itr) {
|
for (boost::filesystem::recursive_directory_iterator itr(path); itr != end_itr; ++itr) {
|
||||||
// Skip if not a file
|
// Skip if not a file
|
||||||
if (!boost::filesystem::is_regular_file(itr->status()))
|
if (!boost::filesystem::is_regular_file(itr->status()))
|
||||||
|
Loading…
Reference in New Issue
Block a user