From cb4d60159db2e145db096f0a96ea314b2664beba Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:24:10 +0530 Subject: [PATCH] revert dash#1494: Don't try to create empty datadir before the real path is known --- src/dash-cli.cpp | 7 +------ src/dashd.cpp | 8 +------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/dash-cli.cpp b/src/dash-cli.cpp index 0e8ddca666..a201ad41d0 100644 --- a/src/dash-cli.cpp +++ b/src/dash-cli.cpp @@ -138,8 +138,7 @@ static int AppInitRPC(int argc, char* argv[]) } return EXIT_SUCCESS; } - bool datadirFromCmdLine = gArgs.IsArgSet("-datadir"); - if (datadirFromCmdLine && !fs::is_directory(GetDataDir(false))) { + if (!fs::is_directory(GetDataDir(false))) { tfm::format(std::cerr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")); return EXIT_FAILURE; } @@ -147,10 +146,6 @@ static int AppInitRPC(int argc, char* argv[]) tfm::format(std::cerr, "Error reading configuration file: %s\n", error); return EXIT_FAILURE; } - if (!datadirFromCmdLine && !fs::is_directory(GetDataDir(false))) { - tfm::format(std::cerr, "Error: Specified data directory \"%s\" from config file does not exist.\n", gArgs.GetArg("-datadir", "")); - return EXIT_FAILURE; - } // Check for -testnet or -regtest parameter (BaseParams() calls are only valid after this clause) try { SelectBaseParams(gArgs.GetChainName()); diff --git a/src/dashd.cpp b/src/dashd.cpp index effadee7f1..16fd408ceb 100644 --- a/src/dashd.cpp +++ b/src/dashd.cpp @@ -87,19 +87,13 @@ static bool AppInit(int argc, char* argv[]) util::Ref context{node}; try { - bool datadirFromCmdLine = gArgs.IsArgSet("-datadir"); - if (datadirFromCmdLine && !fs::is_directory(GetDataDir(false))) + if (!fs::is_directory(GetDataDir(false))) { return InitError(Untranslated(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "")))); } if (!gArgs.ReadConfigFiles(error, true)) { return InitError(Untranslated(strprintf("Error reading configuration file: %s\n", error))); } - if (!datadirFromCmdLine && !fs::is_directory(GetDataDir(false))) - { - tfm::format(std::cerr, "Error: Specified data directory \"%s\" from config file does not exist.\n", gArgs.GetArg("-datadir", "")); - return EXIT_FAILURE; - } // Check for -testnet or -regtest parameter (Params() calls are only valid after this clause) try { SelectParams(gArgs.GetChainName());