From 7ecd3981f2e169d97c9cb1eb69c2257d942864fc Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Thu, 2 May 2019 13:24:43 -0700 Subject: [PATCH] Add command line option to select a zcash.conf --- src/connection.cpp | 6 +++++- src/main.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/connection.cpp b/src/connection.cpp index bed5dcb..9c9f2e3 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -569,7 +569,11 @@ bool ConnectionLoader::verifyParams() { * Try to automatically detect a zcash.conf file in the correct location and load parameters */ std::shared_ptr ConnectionLoader::autoDetectZcashConf() { - auto confLocation = locateZcashConfFile(); + auto confLocation = Settings::getInstance()->getZcashdConfLocation(); + + if (confLocation.isEmpty()) { + confLocation = locateZcashConfFile(); + } if (confLocation.isNull()) { // No Zcash file, just return with nothing diff --git a/src/main.cpp b/src/main.cpp index 58a3bcd..5afd2fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -159,6 +159,11 @@ public: QCommandLineOption noembeddedOption(QStringList() << "no-embedded", "Disable embedded zcashd"); parser.addOption(noembeddedOption); + // Add an option to specify the conf file + QCommandLineOption confOption(QStringList() << "conf", "Use the zcash.conf specified instead of looking for the default one.", + "confFile"); + parser.addOption(confOption); + // Positional argument will specify a zcash payment URI parser.addPositionalArgument("zcashURI", "An optional zcash URI to pay"); @@ -217,6 +222,11 @@ public: Settings::getInstance()->setUseEmbedded(true); } + // Check to see if a conf location was specified + if (parser.isSet(confOption)) { + Settings::getInstance()->setUsingZcashConf(parser.value(confOption)); + } + w = new MainWindow(); w->setWindowTitle("ZecWallet v" + QString(APP_VERSION));