aboutsummaryrefslogtreecommitdiff
path: root/src/db.cpp
diff options
context:
space:
mode:
authorsje397 <sje397@gmail.com>2012-02-14 23:14:43 +1100
committersje397 <sje397@gmail.com>2012-02-15 23:29:59 +1100
commit4efbda3f257bd8e635715377d85862d322c57c4b (patch)
treeb968cfa7ffcded317da62e8792ff1aa3dacb2c88 /src/db.cpp
parent15b87b2ec40bdcbc7e8173c79b829fc0f550909e (diff)
Added 'Backup Wallet' menu option
- icon from the LGPL Nuvola set (like the tick) - http://www.icon-king.com/projects/nuvola/ - include 'boost/version.hpp' in db.cpp so that the overwrite version of copy can be used - catch exceptions in BackupWallet (e.g. filesystem_error thrown when trying to overwrite without the overwrite flag set) - include db.h in walletmodel.cpp for BackupWallet function - updated doc/assets-attribution.txt and contrib/debian/copyright with copyright info for new icon
Diffstat (limited to 'src/db.cpp')
-rw-r--r--src/db.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 3bdda61569..9a904ec2e0 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);