| 729 | } |
| 730 | |
| 731 | bool BerkeleyRODatabase::Backup(const std::string& dest) const |
| 732 | { |
| 733 | fs::path src(m_filepath); |
| 734 | fs::path dst(fs::PathFromString(dest)); |
| 735 | |
| 736 | if (fs::is_directory(dst)) { |
| 737 | dst = BDBDataFile(dst); |
| 738 | } |
| 739 | try { |
| 740 | if (fs::exists(dst) && fs::equivalent(src, dst)) { |
| 741 | LogWarning("cannot backup to wallet source file %s", fs::PathToString(dst)); |
| 742 | return false; |
| 743 | } |
| 744 | |
| 745 | fs::copy_file(src, dst, fs::copy_options::overwrite_existing); |
| 746 | LogInfo("copied %s to %s\n", fs::PathToString(m_filepath), fs::PathToString(dst)); |
| 747 | return true; |
| 748 | } catch (const fs::filesystem_error& e) { |
| 749 | LogWarning("error copying %s to %s - %s\n", fs::PathToString(m_filepath), fs::PathToString(dst), e.code().message()); |
| 750 | return false; |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | bool BerkeleyROBatch::ReadKey(DataStream&& key, DataStream& value) |
| 755 | { |
nothing calls this directly
no test coverage detected