diff options
| author | MeshCollider <[email protected]> | 2017-10-12 22:04:46 +1300 |
|---|---|---|
| committer | MeshCollider <[email protected]> | 2017-11-18 00:50:59 +1300 |
| commit | 8263f6a5ac3f3af102a2819b7e179b00db7e0437 (patch) | |
| tree | 2d08c4f8eeed52a2c1101d0fe1c16556d6da2b73 /src | |
| parent | Default walletdir is wallets/ if it exists (diff) | |
| download | discoin-8263f6a5ac3f3af102a2819b7e179b00db7e0437.tar.xz discoin-8263f6a5ac3f3af102a2819b7e179b00db7e0437.zip | |
Create walletdir if datadir doesn't exist and fix tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/bitcoind.cpp | 4 | ||||
| -rw-r--r-- | src/init.cpp | 1 | ||||
| -rw-r--r-- | src/qt/bitcoin.cpp | 5 | ||||
| -rw-r--r-- | src/qt/intro.cpp | 5 | ||||
| -rw-r--r-- | src/util.cpp | 5 | ||||
| -rw-r--r-- | src/wallet/init.cpp | 6 |
6 files changed, 14 insertions, 12 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index b1f1342aa..bc23912d2 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -101,10 +101,6 @@ bool AppInit(int argc, char* argv[]) fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str()); return false; } - if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) { - fprintf(stderr, "Error: Specified wallet directory \"%s\" does not exist.\n", gArgs.GetArg("-walletdir", "").c_str()); - return false; - } try { gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); diff --git a/src/init.cpp b/src/init.cpp index 93174a11e..439eaacfc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1220,7 +1220,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime())); LogPrintf("Default data directory %s\n", GetDefaultDataDir().string()); LogPrintf("Using data directory %s\n", GetDataDir().string()); - LogPrintf("Using wallet directory %s\n", GetWalletDir().string()); LogPrintf("Using config file %s\n", GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string()); LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD); diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 05af10a52..557d7efce 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -626,11 +626,6 @@ int main(int argc, char *argv[]) QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", "")))); return EXIT_FAILURE; } - if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) { - QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), - QObject::tr("Error: Specified wallet directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-walletdir", "")))); - return EXIT_FAILURE; - } try { gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)); } catch (const std::exception& e) { diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 9e4c76510..7f8a8394e 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -214,7 +214,10 @@ bool Intro::pickDataDirectory() } dataDir = intro.getDataDirectory(); try { - TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir)); + if (TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir))) { + // If a new data directory has been created, make wallets subdirectory too + TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir) / "wallets"); + } break; } catch (const fs::filesystem_error&) { QMessageBox::critical(0, tr(PACKAGE_NAME), diff --git a/src/util.cpp b/src/util.cpp index b87dd091b..d58f39e96 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -574,7 +574,10 @@ const fs::path &GetDataDir(bool fNetSpecific) if (fNetSpecific) path /= BaseParams().DataDir(); - fs::create_directories(path); + if (fs::create_directories(path)) { + // This is the first run, create wallets subdirectory too + fs::create_directories(path / "wallets"); + } return path; } diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 754ed8a67..67c46df87 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -193,6 +193,12 @@ bool VerifyWallets() return true; } + if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) { + return InitError(strprintf(_("Error: Specified wallet directory \"%s\" does not exist."), gArgs.GetArg("-walletdir", "").c_str())); + } + + LogPrintf("Using wallet directory %s\n", GetWalletDir().string()); + uiInterface.InitMessage(_("Verifying wallet(s)...")); // Keep track of each wallet absolute path to detect duplicates. |