Skip to content

Commit

Permalink
Merge pull request #342 from jburkle/datadir_check
Browse files Browse the repository at this point in the history
Edited init.cpp to include a check that -datadir exists
  • Loading branch information
Jeff Garzik committed Jun 24, 2011
2 parents 1179257 + ed2c014 commit 77ba3ab
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/init.cpp
Expand Up @@ -141,10 +141,19 @@ bool AppInit2(int argc, char* argv[])

if (mapArgs.count("-datadir"))
{
filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
if (filesystem::is_directory(filesystem::system_complete(mapArgs["-datadir"])))
{
filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
}
else
{
fprintf(stderr, "Error: Specified directory does not exist\n");
Shutdown(NULL);
}
}


ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir

if (mapArgs.count("-?") || mapArgs.count("--help"))
Expand Down

0 comments on commit 77ba3ab

Please sign in to comment.