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());