diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 638d669c4..eb6d5ecb5 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -108,7 +108,7 @@ CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bo leveldb::Status result = leveldb::DestroyDB(path.string(), options); dbwrapper_private::HandleError(result); } - TryCreateDirectory(path); + TryCreateDirectories(path); LogPrintf("Opening LevelDB in %s\n", path.string()); } leveldb::Status status = leveldb::DB::Open(options, path.string(), &pdb); diff --git a/src/init.cpp b/src/init.cpp index 9d4c92fb8..dbd7bf09e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1762,8 +1762,6 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) fReindex = gArgs.GetBoolArg("-reindex", false); bool fReindexChainState = gArgs.GetBoolArg("-reindex-chainstate", false); - fs::create_directories(GetDataDir() / "blocks"); - // cache size calculations int64_t nTotalCache = (gArgs.GetArg("-dbcache", nDefaultDbCache) << 20); nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 1c7251f3c..6ec5da6d0 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -217,7 +217,7 @@ bool Intro::pickDataDirectory() } dataDir = intro.getDataDirectory(); try { - TryCreateDirectory(GUIUtil::qstringToBoostPath(dataDir)); + TryCreateDirectories(GUIUtil::qstringToBoostPath(dataDir)); break; } catch (const fs::filesystem_error&) { QMessageBox::critical(0, tr(PACKAGE_NAME), diff --git a/src/util.cpp b/src/util.cpp index 581b1faf4..16976cf6c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -757,21 +757,21 @@ bool RenameOver(fs::path src, fs::path dest) } /** - * Ignores exceptions thrown by Boost's create_directory if the requested directory exists. + * Ignores exceptions thrown by Boost's create_directories if the requested directory exists. * Specifically handles case where path p exists, but it wasn't possible for the user to * write to the parent directory. */ -bool TryCreateDirectory(const fs::path& p) +bool TryCreateDirectories(const fs::path& p) { try { - return fs::create_directory(p); + return fs::create_directories(p); } catch (const fs::filesystem_error&) { if (!fs::exists(p) || !fs::is_directory(p)) throw; } - // create_directory didn't create the directory, it had to have existed already + // create_directories didn't create the directory, it had to have existed already return false; } diff --git a/src/util.h b/src/util.h index a38c010ef..41d14e4d4 100644 --- a/src/util.h +++ b/src/util.h @@ -205,7 +205,7 @@ bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length); bool RenameOver(fs::path src, fs::path dest); -bool TryCreateDirectory(const fs::path& p); +bool TryCreateDirectories(const fs::path& p); fs::path GetDefaultDataDir(); const fs::path &GetDataDir(bool fNetSpecific = true); fs::path GetBackupsDir(); diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 24f805562..1ccae8392 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -74,7 +74,7 @@ bool CDBEnv::Open(const fs::path& pathIn) strPath = pathIn.string(); fs::path pathLogDir = pathIn / "database"; - TryCreateDirectory(pathLogDir); + TryCreateDirectories(pathLogDir); fs::path pathErrorFile = pathIn / "db.log"; LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());