diff options
| author | Wladimir J. van der Laan <[email protected]> | 2012-02-17 10:30:15 -0800 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2012-02-17 10:30:15 -0800 |
| commit | ec2ed582323fe05e978073c5f95df8291f06ae62 (patch) | |
| tree | 1a791e2e4cdf77f0252dc929dc55c6fbc1eb8bf6 /src/db.cpp | |
| parent | Change #ifdef GUI to #ifdef QT_GUI, GUI is not defined anymore... (diff) | |
| parent | Added 'Backup Wallet' menu option (diff) | |
| download | discoin-ec2ed582323fe05e978073c5f95df8291f06ae62.tar.xz discoin-ec2ed582323fe05e978073c5f95df8291f06ae62.zip | |
Merge pull request #834 from sje397/BackupWallet
Added 'Backup Wallet' menu option to GUI
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/db.cpp b/src/db.cpp index 3bdda6156..9a904ec2e 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -6,6 +6,7 @@ #include "headers.h" #include "db.h" #include "net.h" +#include <boost/version.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> @@ -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); |