diff options
author | Kiminuo <kiminuo@protonmail.com> | 2020-06-11 08:58:46 +0200 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-02-03 18:35:52 +0800 |
commit | 41d7166c8a598b604aad6c6b1d88ad46e23be247 (patch) | |
tree | 883af805ab387dc7db01602a19ccd70d89b78cb1 /src/wallet/bdb.cpp | |
parent | ffc89d1f21258553c0087b774a9ea1ce84139d4f (diff) |
refactor: replace boost::filesystem with std::filesystem
Warning: Replacing fs::system_complete calls with fs::absolute calls
in this commit may cause minor changes in behaviour because fs::absolute
no longer strips trailing slashes; however these changes are believed to
be safe.
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Diffstat (limited to 'src/wallet/bdb.cpp')
-rw-r--r-- | src/wallet/bdb.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp index cea120a81e..49f0abf9e7 100644 --- a/src/wallet/bdb.cpp +++ b/src/wallet/bdb.cpp @@ -3,6 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include <fs.h> #include <wallet/bdb.h> #include <wallet/db.h> @@ -620,12 +621,12 @@ bool BerkeleyDatabase::Backup(const std::string& strDest) const pathDest /= fs::PathFromString(strFile); try { - if (fs::equivalent(pathSrc, pathDest)) { + if (fs::exists(pathDest) && fs::equivalent(pathSrc, pathDest)) { LogPrintf("cannot backup to wallet source file %s\n", fs::PathToString(pathDest)); return false; } - fs::copy_file(pathSrc, pathDest, fs::copy_option::overwrite_if_exists); + fs::copy_file(pathSrc, pathDest, fs::copy_options::overwrite_existing); LogPrintf("copied %s to %s\n", strFile, fs::PathToString(pathDest)); return true; } catch (const fs::filesystem_error& e) { |