X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fdb.cpp;h=9a904ec2e07a69acf033089886bed2d41067366f;hp=3bdda61569218e20fdb12698143c8f814b2b087f;hb=4efbda3f257bd8e635715377d85862d322c57c4b;hpb=15b87b2ec40bdcbc7e8173c79b829fc0f550909e diff --git a/src/db.cpp b/src/db.cpp index 3bdda61..9a904ec 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -6,6 +6,7 @@ #include "headers.h" #include "db.h" #include "net.h" +#include #include #include @@ -1064,14 +1065,19 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) filesystem::path pathDest(strDest); if (filesystem::is_directory(pathDest)) pathDest = pathDest / wallet.strWalletFile; + + try { #if BOOST_VERSION >= 104000 - filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); + filesystem::copy_file(pathSrc, pathDest, filesystem::copy_option::overwrite_if_exists); #else - filesystem::copy_file(pathSrc, pathDest); + filesystem::copy_file(pathSrc, pathDest); #endif - printf("copied wallet.dat to %s\n", pathDest.string().c_str()); - - return true; + printf("copied wallet.dat to %s\n", pathDest.string().c_str()); + return true; + } catch(const filesystem::filesystem_error &e) { + printf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what()); + return false; + } } } Sleep(100);