4
4
5
5
#include < wallet/walletutil.h>
6
6
7
+ #include < logging.h>
7
8
#include < util/system.h>
8
9
9
10
fs::path GetWalletDir ()
@@ -33,7 +34,9 @@ static bool IsBerkeleyBtree(const fs::path& path)
33
34
// A Berkeley DB Btree file has at least 4K.
34
35
// This check also prevents opening lock files.
35
36
boost::system::error_code ec;
36
- if (fs::file_size (path, ec) < 4096 ) return false ;
37
+ auto size = fs::file_size (path, ec);
38
+ if (ec) LogPrintf (" %s: %s %s\n " , __func__, ec.message (), path.string ());
39
+ if (size < 4096 ) return false ;
37
40
38
41
fsbridge::ifstream file (path, std::ios::binary);
39
42
if (!file.is_open ()) return false ;
@@ -54,8 +57,14 @@ std::vector<fs::path> ListWalletDir()
54
57
const fs::path wallet_dir = GetWalletDir ();
55
58
const size_t offset = wallet_dir.string ().size () + 1 ;
56
59
std::vector<fs::path> paths;
60
+ boost::system::error_code ec;
61
+
62
+ for (auto it = fs::recursive_directory_iterator (wallet_dir, ec); it != fs::recursive_directory_iterator (); it.increment (ec)) {
63
+ if (ec) {
64
+ LogPrintf (" %s: %s %s\n " , __func__, ec.message (), it->path ().string ());
65
+ continue ;
66
+ }
57
67
58
- for (auto it = fs::recursive_directory_iterator (wallet_dir); it != fs::recursive_directory_iterator (); ++it) {
59
68
// Get wallet path relative to walletdir by removing walletdir from the wallet path.
60
69
// This can be replaced by boost::filesystem::lexically_relative once boost is bumped to 1.60.
61
70
const fs::path path = it->path ().string ().substr (offset);
0 commit comments