diff options
-rw-r--r-- | src/init.cpp | 18 | ||||
-rw-r--r-- | src/init.h | 1 | ||||
-rw-r--r-- | src/qt/locale/bitcoin_en.ts | 102 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 2 |
4 files changed, 113 insertions, 10 deletions
diff --git a/src/init.cpp b/src/init.cpp index c5a8cc9fbe..90dbad61b7 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -29,6 +29,7 @@ using namespace std; using namespace boost; +std::string strWalletFile; CWallet* pwalletMain; CClientUIInterface uiInterface; @@ -169,6 +170,7 @@ std::string HelpMessage() strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n"; strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n"; + strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + "\n"; strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n"; strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n"; strUsage += " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n"; @@ -493,10 +495,16 @@ bool AppInit2(boost::thread_group& threadGroup) InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.")); } + strWalletFile = GetArg("-wallet", "wallet.dat"); + // ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log std::string strDataDir = GetDataDir().string(); + // Wallet file must be a plain filename without a directory + if (strWalletFile != boost::filesystem::basename(strWalletFile) + boost::filesystem::extension(strWalletFile)) + return InitError(strprintf(_("Wallet %s resides outside data directory %s\n"), strWalletFile.c_str(), strDataDir.c_str())); + // Make sure only a single Bitcoin process is using the data directory. boost::filesystem::path pathLockFile = GetDataDir() / ".lock"; FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist. @@ -555,13 +563,13 @@ bool AppInit2(boost::thread_group& threadGroup) if (GetBoolArg("-salvagewallet", false)) { // Recover readable keypairs: - if (!CWalletDB::Recover(bitdb, "wallet.dat", true)) + if (!CWalletDB::Recover(bitdb, strWalletFile, true)) return false; } - if (filesystem::exists(GetDataDir() / "wallet.dat")) + if (filesystem::exists(GetDataDir() / strWalletFile)) { - CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover); + CDBEnv::VerifyResult r = bitdb.Verify(strWalletFile, CWalletDB::Recover); if (r == CDBEnv::RECOVER_OK) { string msg = strprintf(_("Warning: wallet.dat corrupt, data salvaged!" @@ -839,7 +847,7 @@ bool AppInit2(boost::thread_group& threadGroup) nStart = GetTimeMillis(); bool fFirstRun = true; - pwalletMain = new CWallet("wallet.dat"); + pwalletMain = new CWallet(strWalletFile); DBErrors nLoadWalletRet = pwalletMain->LoadWallet(fFirstRun); if (nLoadWalletRet != DB_LOAD_OK) { @@ -904,7 +912,7 @@ bool AppInit2(boost::thread_group& threadGroup) pindexRescan = pindexGenesisBlock; else { - CWalletDB walletdb("wallet.dat"); + CWalletDB walletdb(strWalletFile); CBlockLocator locator; if (walletdb.ReadBestBlock(locator)) pindexRescan = locator.GetBlockIndex(); diff --git a/src/init.h b/src/init.h index 5927670c83..a4d5a67252 100644 --- a/src/init.h +++ b/src/init.h @@ -7,6 +7,7 @@ #include "wallet.h" +extern std::string strWalletFile; extern CWallet* pwalletMain; void StartShutdown(); diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index 7628b39bd3..61af88d056 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0" language="en"> -<defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> @@ -689,7 +688,7 @@ Address: %4 <translation>Wallet is <b>encrypted</b> and currently <b>locked</b></translation> </message> <message> - <location filename="../bitcoin.cpp" line="+109"/> + <location filename="../bitcoin.cpp" line="+111"/> <source>A fatal error occurred. Bitcoin can no longer continue safely and will quit.</source> <translation>A fatal error occurred. Bitcoin can no longer continue safely and will quit.</translation> </message> @@ -771,15 +770,38 @@ Address: %4 </message> </context> <context> + <name>FreespaceChecker</name> + <message> + <location filename="../intro.cpp" line="+60"/> + <source>A new data directory will be created.</source> + <translation>A new data directory will be created.</translation> + </message> + <message> + <location line="+17"/> + <source>Directory already exists. Add <code>%1name</code> if you intend to create a new directory here.</source> + <translation>Directory already exists. Add <code>%1name</code> if you intend to create a new directory here.</translation> + </message> + <message> + <location line="+3"/> + <source>Path already exists, and is not a directory.</source> + <translation>Path already exists, and is not a directory.</translation> + </message> + <message> + <location line="+7"/> + <source>Cannot create data directory here.</source> + <translation>Cannot create data directory here.</translation> + </message> +</context> +<context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+493"/> - <location line="+12"/> + <location line="+13"/> <source>Bitcoin-Qt</source> <translation>Bitcoin-Qt</translation> </message> <message> - <location line="-12"/> + <location line="-13"/> <source>version</source> <translation>version</translation> </message> @@ -813,6 +835,59 @@ Address: %4 <source>Show splash screen on startup (default: 1)</source> <translation>Show splash screen on startup (default: 1)</translation> </message> + <message> + <location line="+1"/> + <source>Choose data directory on startup (default: 0)</source> + <translation>Choose data directory on startup (default: 0)</translation> + </message> +</context> +<context> + <name>Intro</name> + <message> + <location filename="../forms/intro.ui" line="+14"/> + <source>Welcome</source> + <translation>Welcome</translation> + </message> + <message> + <location line="+9"/> + <source>Welcome to Bitcoin-Qt.</source> + <translation>Welcome to Bitcoin-Qt.</translation> + </message> + <message> + <location line="+26"/> + <source>As this is the first time the program is launched, you can choose where Bitcoin-Qt will store its data.</source> + <translation>As this is the first time the program is launched, you can choose where Bitcoin-Qt will store its data.</translation> + </message> + <message> + <location line="+10"/> + <source>Bitcoin-Qt will download and store a copy of the Bitcoin block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</source> + <translation>Bitcoin-Qt will download and store a copy of the Bitcoin block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</translation> + </message> + <message> + <location line="+10"/> + <source>Use the default data directory</source> + <translation>Use the default data directory</translation> + </message> + <message> + <location line="+7"/> + <source>Use a custom data directory:</source> + <translation>Use a custom data directory:</translation> + </message> + <message> + <location filename="../intro.cpp" line="+100"/> + <source>Error</source> + <translation>Error</translation> + </message> + <message> + <location line="+9"/> + <source>GB of free space available</source> + <translation>GB of free space available</translation> + </message> + <message> + <location line="+3"/> + <source>(of %1GB needed)</source> + <translation>(of %1GB needed)</translation> + </message> </context> <context> <name>OptionsDialog</name> @@ -1103,6 +1178,25 @@ Address: %4 </message> </context> <context> + <name>QObject</name> + <message> + <location filename="../bitcoin.cpp" line="+92"/> + <location filename="../intro.cpp" line="-32"/> + <source>Bitcoin</source> + <translation>Bitcoin</translation> + </message> + <message> + <location line="+1"/> + <source>Error: Specified data directory "%1" does not exist.</source> + <translation>Error: Specified data directory "%1" does not exist.</translation> + </message> + <message> + <location filename="../intro.cpp" line="+1"/> + <source>Error: Specified data directory "%1" can not be created.</source> + <translation>Error: Specified data directory "%1" can not be created.</translation> + </message> +</context> +<context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 6b1b4e3d8e..7ebe5b4755 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -89,7 +89,7 @@ bool OptionsModel::Upgrade() settings.setValue("bImportFinished", true); // Move settings from old wallet.dat (if any): - CWalletDB walletdb("wallet.dat"); + CWalletDB walletdb(strWalletFile); QList<QString> intOptions; intOptions << "nDisplayUnit" << "nTransactionFee"; |