mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-23 22:19:39 +01:00
Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem. To repeat this, simply run: ``` git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g' ```
This commit is contained in:
@@ -3314,8 +3314,8 @@ void UnlinkPrunedFiles(const std::set<int>& setFilesToPrune)
|
||||
{
|
||||
for (std::set<int>::iterator it = setFilesToPrune.begin(); it != setFilesToPrune.end(); ++it) {
|
||||
CDiskBlockPos pos(*it, 0);
|
||||
boost::filesystem::remove(GetBlockPosFilename(pos, "blk"));
|
||||
boost::filesystem::remove(GetBlockPosFilename(pos, "rev"));
|
||||
fs::remove(GetBlockPosFilename(pos, "blk"));
|
||||
fs::remove(GetBlockPosFilename(pos, "rev"));
|
||||
LogPrintf("Prune: %s deleted blk/rev (%05u)\n", __func__, *it);
|
||||
}
|
||||
}
|
||||
@@ -3399,7 +3399,7 @@ void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight
|
||||
|
||||
bool CheckDiskSpace(uint64_t nAdditionalBytes)
|
||||
{
|
||||
uint64_t nFreeBytesAvailable = boost::filesystem::space(GetDataDir()).available;
|
||||
uint64_t nFreeBytesAvailable = fs::space(GetDataDir()).available;
|
||||
|
||||
// Check for nMinDiskSpace bytes (currently 50MB)
|
||||
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
|
||||
@@ -3412,8 +3412,8 @@ FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
|
||||
{
|
||||
if (pos.IsNull())
|
||||
return NULL;
|
||||
boost::filesystem::path path = GetBlockPosFilename(pos, prefix);
|
||||
boost::filesystem::create_directories(path.parent_path());
|
||||
fs::path path = GetBlockPosFilename(pos, prefix);
|
||||
fs::create_directories(path.parent_path());
|
||||
FILE* file = fopen(path.string().c_str(), "rb+");
|
||||
if (!file && !fReadOnly)
|
||||
file = fopen(path.string().c_str(), "wb+");
|
||||
@@ -3439,7 +3439,7 @@ FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) {
|
||||
return OpenDiskFile(pos, "rev", fReadOnly);
|
||||
}
|
||||
|
||||
boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
|
||||
fs::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
|
||||
{
|
||||
return GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user