From 3b5966eefd81a4998db482cc016a607d35880094 Mon Sep 17 00:00:00 2001 From: elbandi Date: Tue, 25 Oct 2016 22:01:52 +0000 Subject: [PATCH 1/3] Allow configure params directory --- src/util.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index ef2ae9b74..24b5955ed 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -502,7 +502,7 @@ static boost::filesystem::path pathCachedNetSpecific; static boost::filesystem::path zc_paramsPathCached; static CCriticalSection csPathCached; -static boost::filesystem::path ZC_GetBaseParamsDir() +static boost::filesystem::path ZC_GetDefaultBaseParamsDir() { // Copied from GetDefaultDataDir and adapter for zcash params. @@ -546,7 +546,15 @@ const boost::filesystem::path &ZC_GetParamsDir() if (!path.empty()) return path; - path = ZC_GetBaseParamsDir(); + if (mapArgs.count("-paramsdir")) { + path = fs::system_complete(mapArgs["-paramsdir"]); + if (!fs::is_directory(path)) { + path = ""; + return path; + } + } else { + path = ZC_GetDefaultBaseParamsDir(); + } return path; } From beae52ef9b13cead2ea00ee60a2a303cabfc1ed5 Mon Sep 17 00:00:00 2001 From: elbandi Date: Fri, 21 Dec 2018 22:37:18 +0100 Subject: [PATCH 2/3] Add paramsdir option for manpage --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/init.cpp b/src/init.cpp index a52205233..9a4553013 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -335,6 +335,7 @@ std::string HelpMessage(HelpMessageMode mode) #endif } strUsage += HelpMessageOpt("-datadir=", _("Specify data directory")); + strUsage += HelpMessageOpt("-paramsdir=", _("Specify Zcash network parameters directory")); strUsage += HelpMessageOpt("-dbcache=", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache)); strUsage += HelpMessageOpt("-debuglogfile=", strprintf(_("Specify location of debug log file: this can be an absolute path or a path relative to the data directory (default: %s)"), DEFAULT_DEBUGLOGFILE)); strUsage += HelpMessageOpt("-exportdir=", _("Specify directory to be used when exporting data")); From 1bd4d236d49804eb0bfbfadb4e979ca9f067e7ed Mon Sep 17 00:00:00 2001 From: elbandi Date: Fri, 5 Jun 2020 20:36:38 +0200 Subject: [PATCH 3/3] Throw error if -paramsdir not a valid directory --- src/util.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 24b5955ed..e6dfcc2a0 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -549,8 +549,7 @@ const boost::filesystem::path &ZC_GetParamsDir() if (mapArgs.count("-paramsdir")) { path = fs::system_complete(mapArgs["-paramsdir"]); if (!fs::is_directory(path)) { - path = ""; - return path; + throw std::runtime_error(strprintf("The -paramsdir '%s' does not exist or is not a directory", path.string())); } } else { path = ZC_GetDefaultBaseParamsDir();