MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / Backup

Method Backup

src/wallet/migrate.cpp:731–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731bool 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
754bool BerkeleyROBatch::ReadKey(DataStream&& key, DataStream& value)
755{

Callers

nothing calls this directly

Calls 6

PathFromStringFunction · 0.85
BDBDataFileFunction · 0.85
existsFunction · 0.85
PathToStringFunction · 0.85
copy_fileFunction · 0.85
messageMethod · 0.45

Tested by

no test coverage detected