diff options
author | Jeff Garzik <jgarzik@exmulti.com> | 2011-06-23 21:43:30 -0700 |
---|---|---|
committer | Jeff Garzik <jgarzik@exmulti.com> | 2011-06-23 21:43:30 -0700 |
commit | 77ba3ab99c0803ef1f7d03b7884c75588b6e09de (patch) | |
tree | d3cf489b80bb4c8580eb5a21b8ae24b3eae60a6d /src | |
parent | 1179257bfd1d0f7742d57449b37c40c28464f152 (diff) | |
parent | ed2c01405f5a5b913c4fd64397394559051e041a (diff) |
Merge pull request #342 from jburkle/datadir_check
Edited init.cpp to include a check that -datadir exists
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index a0c90e0a7a..ebe176a5e4 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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")) |