@@ -49,26 +49,31 @@ std::vector<fs::path> ListWalletDir()
49
49
continue ;
50
50
}
51
51
52
- // Get wallet path relative to walletdir by removing walletdir from the wallet path.
53
- // This can be replaced by boost::filesystem::lexically_relative once boost is bumped to 1.60.
54
- const fs::path path = it->path ().string ().substr (offset);
52
+ try {
53
+ // Get wallet path relative to walletdir by removing walletdir from the wallet path.
54
+ // This can be replaced by boost::filesystem::lexically_relative once boost is bumped to 1.60.
55
+ const fs::path path = it->path ().string ().substr (offset);
55
56
56
- if (it->status ().type () == fs::directory_file &&
57
- (ExistsBerkeleyDatabase (it->path ()) || ExistsSQLiteDatabase (it->path ()))) {
58
- // Found a directory which contains wallet.dat btree file, add it as a wallet.
59
- paths.emplace_back (path);
60
- } else if (it.level () == 0 && it->symlink_status ().type () == fs::regular_file && ExistsBerkeleyDatabase (it->path ())) {
61
- if (it->path ().filename () == " wallet.dat" ) {
62
- // Found top-level wallet.dat btree file, add top level directory ""
63
- // as a wallet.
64
- paths.emplace_back ();
65
- } else {
66
- // Found top-level btree file not called wallet.dat. Current bitcoin
67
- // software will never create these files but will allow them to be
68
- // opened in a shared database environment for backwards compatibility.
69
- // Add it to the list of available wallets.
57
+ if (it->status ().type () == fs::directory_file &&
58
+ (ExistsBerkeleyDatabase (it->path ()) || ExistsSQLiteDatabase (it->path ()))) {
59
+ // Found a directory which contains wallet.dat btree file, add it as a wallet.
70
60
paths.emplace_back (path);
61
+ } else if (it.level () == 0 && it->symlink_status ().type () == fs::regular_file && ExistsBerkeleyDatabase (it->path ())) {
62
+ if (it->path ().filename () == " wallet.dat" ) {
63
+ // Found top-level wallet.dat btree file, add top level directory ""
64
+ // as a wallet.
65
+ paths.emplace_back ();
66
+ } else {
67
+ // Found top-level btree file not called wallet.dat. Current bitcoin
68
+ // software will never create these files but will allow them to be
69
+ // opened in a shared database environment for backwards compatibility.
70
+ // Add it to the list of available wallets.
71
+ paths.emplace_back (path);
72
+ }
71
73
}
74
+ } catch (const std::exception& e) {
75
+ LogPrintf (" %s: Error scanning %s: %s\n " , __func__, it->path ().string (), e.what ());
76
+ it.no_push ();
72
77
}
73
78
}
74
79
0 commit comments