mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
refactor: Replace <filesystem> with <util/fs.h>
All code in this repo uses <util/fs.h>, except for a few lines. This is confusing and potentially dangerous, if the safe <util/fs.h> wrappers are not used.
This commit is contained in:
parent
f5c5ddafbc
commit
fada2f9110
5 changed files with 7 additions and 9 deletions
|
@ -26,13 +26,13 @@
|
|||
#include <scheduler.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <util/chaintype.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/thread.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
|
@ -50,8 +50,8 @@ int main(int argc, char* argv[])
|
|||
<< " BREAK IN FUTURE VERSIONS. DO NOT USE ON YOUR ACTUAL DATADIR." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::filesystem::path abs_datadir = std::filesystem::absolute(argv[1]);
|
||||
std::filesystem::create_directories(abs_datadir);
|
||||
fs::path abs_datadir{fs::absolute(argv[1])};
|
||||
fs::create_directories(abs_datadir);
|
||||
|
||||
|
||||
// SETUP: Context
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
|
|
|
@ -1031,8 +1031,8 @@ void CBlockPolicyEstimator::FlushUnconfirmed()
|
|||
|
||||
std::chrono::hours CBlockPolicyEstimator::GetFeeEstimatorFileAge()
|
||||
{
|
||||
auto file_time = std::filesystem::last_write_time(m_estimation_filepath);
|
||||
auto now = std::filesystem::file_time_type::clock::now();
|
||||
auto file_time{fs::last_write_time(m_estimation_filepath)};
|
||||
auto now{fs::file_time_type::clock::now()};
|
||||
return std::chrono::duration_cast<std::chrono::hours>(now - file_time);
|
||||
}
|
||||
|
||||
|
|
|
@ -184,6 +184,7 @@ static inline path PathFromString(const std::string& string)
|
|||
* already exists or is a symlink to an existing directory.
|
||||
* This is a temporary workaround for an issue in libstdc++ that has been fixed
|
||||
* upstream [PR101510].
|
||||
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510
|
||||
*/
|
||||
static inline bool create_directories(const std::filesystem::path& p)
|
||||
{
|
||||
|
|
|
@ -11,13 +11,11 @@
|
|||
|
||||
#include <logging.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/getuniquepath.h>
|
||||
#include <util/syserror.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
@ -263,7 +261,7 @@ bool RenameOver(fs::path src, fs::path dest)
|
|||
{
|
||||
#ifdef __MINGW64__
|
||||
// This is a workaround for a bug in libstdc++ which
|
||||
// implements std::filesystem::rename with _wrename function.
|
||||
// implements fs::rename with _wrename function.
|
||||
// This bug has been fixed in upstream:
|
||||
// - GCC 10.3: 8dd1c1085587c9f8a21bb5e588dfe1e8cdbba79e
|
||||
// - GCC 11.1: 1dfd95f0a0ca1d9e6cbc00e6cbfd1fa20a98f312
|
||||
|
|
Loading…
Reference in a new issue