22 | @@ -19,6 +23,12 @@ std::vector<fs::path> ListDatabases(const fs::path& wallet_dir)
23 | for (auto it = fs::recursive_directory_iterator(wallet_dir, ec); it != fs::recursive_directory_iterator(); it.increment(ec)) {
24 | if (ec) {
25 | LogPrintf("%s: %s %s\n", __func__, ec.message(), it->path().string());
26 | +#ifdef WIN32
27 | + if (ec.value() == boost::system::windows_error::access_denied) {
Is this specific to windows? Or could this happen with directory "access denied" errors on other OSes as well?
Is this specific to windows?
The error code is specific to windows.
Or could this happen with directory "access denied" errors on other OSes as well?
Yes, it could. But on other OSes the reason of "access denied" errors is a bad setup that a user can/should fix. On windows this situation seems common and not always fixable by a user.
Maybe it should avoid recursion regardless of the error and platform? Is there any case where this approach is not desirable?
Maybe it should avoid recursion regardless of the error and platform? Is there any case where this approach is not desirable?
To be sure I understand you correctly, you are suggesting do not iterate a directory if we have any error while accessing it, right?
Yes, that was my suggestion. Is there any downside of that approach?