From 9fe94c47c32aeb3c613707a4e3c27bae5ccebbb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 13:47:08 +0000 Subject: [PATCH] Replace boost::filesystem with std::filesystem across codebase Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/ec2fa57d-2d9c-4388-b4e1-90a40f55b5e8 Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com> --- include/xrpl/basics/Archive.h | 4 +- include/xrpl/basics/FileUtilities.h | 14 ++-- include/xrpl/basics/Log.h | 8 +-- include/xrpl/beast/unit_test/suite.h | 4 +- include/xrpl/beast/utility/temp_dir.h | 23 ++++--- include/xrpl/core/PerfLog.h | 7 +- include/xrpl/rdb/DatabaseCon.h | 11 ++- include/xrpl/rdb/RelationalDatabase.h | 1 - include/xrpl/server/State.h | 2 - src/libxrpl/basics/Archive.cpp | 6 +- src/libxrpl/basics/FileUtilities.cpp | 32 ++++----- src/libxrpl/basics/Log.cpp | 6 +- src/libxrpl/nodestore/backend/NuDBFactory.cpp | 15 ++-- .../nodestore/backend/RocksDBFactory.cpp | 8 +-- src/libxrpl/rdb/SociDB.cpp | 8 +-- src/libxrpl/server/Vacuum.cpp | 5 +- src/test/app/GRPCServerTLS_test.cpp | 14 ++-- src/test/app/LedgerLoad_test.cpp | 6 +- src/test/app/Manifest_test.cpp | 18 ++--- src/test/app/SHAMapStore_test.cpp | 4 +- src/test/app/ValidatorSite_test.cpp | 6 +- src/test/basics/FileUtilities_test.cpp | 8 +-- src/test/basics/PerfLog_test.cpp | 38 +++++----- src/test/core/Config_test.cpp | 14 ++-- src/test/core/SociDB_test.cpp | 24 +++---- src/test/unit_test/FileDirGuard.h | 13 ++-- src/xrpld/app/main/GRPCServer.cpp | 2 +- src/xrpld/app/misc/SHAMapStoreImp.cpp | 42 ++++++----- src/xrpld/app/misc/ValidatorList.h | 5 +- src/xrpld/app/misc/detail/ValidatorList.cpp | 24 +++---- src/xrpld/app/rdb/backend/detail/Node.cpp | 15 ++-- src/xrpld/core/Config.h | 10 +-- src/xrpld/core/detail/Config.cpp | 69 ++++++++++--------- src/xrpld/perflog/detail/PerfLogImp.cpp | 17 ++--- 34 files changed, 239 insertions(+), 244 deletions(-) diff --git a/include/xrpl/basics/Archive.h b/include/xrpl/basics/Archive.h index 58e12bbb71..ae7b0cc136 100644 --- a/include/xrpl/basics/Archive.h +++ b/include/xrpl/basics/Archive.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { @@ -12,6 +12,6 @@ namespace xrpl { @throws runtime_error */ void -extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst); +extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst); } // namespace xrpl diff --git a/include/xrpl/basics/FileUtilities.h b/include/xrpl/basics/FileUtilities.h index 8cf7e4893f..ad28f5e158 100644 --- a/include/xrpl/basics/FileUtilities.h +++ b/include/xrpl/basics/FileUtilities.h @@ -1,22 +1,22 @@ #pragma once -#include -#include - +#include #include +#include +#include namespace xrpl { std::string getFileContents( - boost::system::error_code& ec, - boost::filesystem::path const& sourcePath, + std::error_code& ec, + std::filesystem::path const& sourcePath, std::optional maxSize = std::nullopt); void writeFileContents( - boost::system::error_code& ec, - boost::filesystem::path const& destPath, + std::error_code& ec, + std::filesystem::path const& destPath, std::string const& contents); } // namespace xrpl diff --git a/include/xrpl/basics/Log.h b/include/xrpl/basics/Log.h index 4efbec5199..278a4894eb 100644 --- a/include/xrpl/basics/Log.h +++ b/include/xrpl/basics/Log.h @@ -4,8 +4,8 @@ #include #include -#include +#include #include #include #include @@ -88,7 +88,7 @@ private: @return `true` if the file was opened. */ bool - open(boost::filesystem::path const& path); + open(std::filesystem::path const& path); /** Close and re-open the system file associated with the log This assists in interoperating with external log management tools. @@ -130,7 +130,7 @@ private: private: std::unique_ptr m_stream; - boost::filesystem::path m_path; + std::filesystem::path m_path; }; std::mutex mutable mutex_; @@ -149,7 +149,7 @@ public: virtual ~Logs() = default; bool - open(boost::filesystem::path const& pathToLogFile); + open(std::filesystem::path const& pathToLogFile); beast::Journal::Sink& get(std::string const& name); diff --git a/include/xrpl/beast/unit_test/suite.h b/include/xrpl/beast/unit_test/suite.h index 1719c519cf..502b36cd5d 100644 --- a/include/xrpl/beast/unit_test/suite.h +++ b/include/xrpl/beast/unit_test/suite.h @@ -6,10 +6,10 @@ #include -#include #include #include +#include #include #include #include @@ -25,7 +25,7 @@ make_reason(String const& reason, char const* file, int line) std::string s(reason); if (!s.empty()) s.append(": "); - namespace fs = boost::filesystem; + namespace fs = std::filesystem; s.append(fs::path{file}.filename().string()); s.append("("); s.append(boost::lexical_cast(line)); diff --git a/include/xrpl/beast/utility/temp_dir.h b/include/xrpl/beast/utility/temp_dir.h index 5aa7b28ac2..71ceeb5d48 100644 --- a/include/xrpl/beast/utility/temp_dir.h +++ b/include/xrpl/beast/utility/temp_dir.h @@ -1,8 +1,10 @@ #pragma once -#include - +#include +#include +#include #include +#include namespace beast { @@ -13,7 +15,7 @@ namespace beast { */ class temp_dir { - boost::filesystem::path path_; + std::filesystem::path path_; public: #if !GENERATING_DOCS @@ -25,20 +27,23 @@ public: /// Construct a temporary directory. temp_dir() { - auto const dir = boost::filesystem::temp_directory_path(); + auto const dir = std::filesystem::temp_directory_path(); + std::random_device rd; do { - path_ = dir / boost::filesystem::unique_path(); - } while (boost::filesystem::exists(path_)); - boost::filesystem::create_directory(path_); + std::ostringstream oss; + oss << std::hex << rd() << rd(); + path_ = dir / oss.str(); + } while (std::filesystem::exists(path_)); + std::filesystem::create_directory(path_); } /// Destroy a temporary directory. ~temp_dir() { // use non-throwing calls in the destructor - boost::system::error_code ec; - boost::filesystem::remove_all(path_, ec); + std::error_code ec; + std::filesystem::remove_all(path_, ec); // TODO: warn/notify if ec set ? } diff --git a/include/xrpl/core/PerfLog.h b/include/xrpl/core/PerfLog.h index 8da6a313c8..0e84c8a3df 100644 --- a/include/xrpl/core/PerfLog.h +++ b/include/xrpl/core/PerfLog.h @@ -4,10 +4,9 @@ #include #include -#include - #include #include +#include #include #include #include @@ -43,7 +42,7 @@ public: */ struct Setup { - boost::filesystem::path perfLog; + std::filesystem::path perfLog; // log_interval is in milliseconds to support faster testing. milliseconds logInterval{seconds(1)}; }; @@ -148,7 +147,7 @@ public: }; PerfLog::Setup -setup_PerfLog(Section const& section, boost::filesystem::path const& configDir); +setup_PerfLog(Section const& section, std::filesystem::path const& configDir); std::unique_ptr make_PerfLog( diff --git a/include/xrpl/rdb/DatabaseCon.h b/include/xrpl/rdb/DatabaseCon.h index 579f30516b..9a62a650ac 100644 --- a/include/xrpl/rdb/DatabaseCon.h +++ b/include/xrpl/rdb/DatabaseCon.h @@ -6,8 +6,7 @@ #include #include -#include - +#include #include #include #include @@ -72,7 +71,7 @@ public: StartUpType startUp = StartUpType::Normal; bool standAlone = false; - boost::filesystem::path dataDir; + std::filesystem::path dataDir; // Indicates whether or not to return the `globalPragma` // from commonPragma() bool useGlobalPragma = false; @@ -134,7 +133,7 @@ public: template DatabaseCon( - boost::filesystem::path const& dataDir, + std::filesystem::path const& dataDir, std::string const& dbName, std::array const& pragma, std::array const& initSQL, @@ -146,7 +145,7 @@ public: // Use this constructor to setup checkpointing template DatabaseCon( - boost::filesystem::path const& dataDir, + std::filesystem::path const& dataDir, std::string const& dbName, std::array const& pragma, std::array const& initSQL, @@ -181,7 +180,7 @@ private: template DatabaseCon( - boost::filesystem::path const& pPath, + std::filesystem::path const& pPath, std::vector const* commonPragma, std::array const& pragma, std::array const& initSQL, diff --git a/include/xrpl/rdb/RelationalDatabase.h b/include/xrpl/rdb/RelationalDatabase.h index 1c28ddec0a..e5cb09e665 100644 --- a/include/xrpl/rdb/RelationalDatabase.h +++ b/include/xrpl/rdb/RelationalDatabase.h @@ -10,7 +10,6 @@ #include #include -#include #include namespace xrpl { diff --git a/include/xrpl/server/State.h b/include/xrpl/server/State.h index c3cc4f609c..eb477a3911 100644 --- a/include/xrpl/server/State.h +++ b/include/xrpl/server/State.h @@ -4,8 +4,6 @@ #include #include -#include - namespace xrpl { struct SavedState diff --git a/src/libxrpl/basics/Archive.cpp b/src/libxrpl/basics/Archive.cpp index bba144ed04..e41d509752 100644 --- a/src/libxrpl/basics/Archive.cpp +++ b/src/libxrpl/basics/Archive.cpp @@ -2,20 +2,18 @@ #include -#include -#include - #include #include #include +#include #include #include namespace xrpl { void -extractTarLz4(boost::filesystem::path const& src, boost::filesystem::path const& dst) +extractTarLz4(std::filesystem::path const& src, std::filesystem::path const& dst) { if (!is_regular_file(src)) Throw("Invalid source file"); diff --git a/src/libxrpl/basics/FileUtilities.cpp b/src/libxrpl/basics/FileUtilities.cpp index 1a6e604724..9ef5fe58cf 100644 --- a/src/libxrpl/basics/FileUtilities.cpp +++ b/src/libxrpl/basics/FileUtilities.cpp @@ -1,29 +1,24 @@ #include -#include -#include -#include -#include -#include - #include #include +#include #include #include #include #include #include +#include namespace xrpl { std::string getFileContents( - boost::system::error_code& ec, - boost::filesystem::path const& sourcePath, + std::error_code& ec, + std::filesystem::path const& sourcePath, std::optional maxSize) { - using namespace boost::filesystem; - using namespace boost::system::errc; + using namespace std::filesystem; path const fullPath{canonical(sourcePath, ec)}; if (ec) @@ -32,7 +27,7 @@ getFileContents( if (maxSize && (file_size(fullPath, ec) > *maxSize || ec)) { if (!ec) - ec = make_error_code(file_too_large); + ec = make_error_code(std::errc::file_too_large); return {}; } @@ -40,7 +35,7 @@ getFileContents( if (!fileStream) { - ec = make_error_code(static_cast(errno)); + ec = make_error_code(static_cast(errno)); return {}; } @@ -49,7 +44,7 @@ getFileContents( if (fileStream.bad()) { - ec = make_error_code(static_cast(errno)); + ec = make_error_code(static_cast(errno)); return {}; } @@ -58,18 +53,15 @@ getFileContents( void writeFileContents( - boost::system::error_code& ec, - boost::filesystem::path const& destPath, + std::error_code& ec, + std::filesystem::path const& destPath, std::string const& contents) { - using namespace boost::filesystem; - using namespace boost::system::errc; - std::ofstream fileStream(destPath.string(), std::ios::out | std::ios::trunc); if (!fileStream) { - ec = make_error_code(static_cast(errno)); + ec = make_error_code(static_cast(errno)); return; } @@ -77,7 +69,7 @@ writeFileContents( if (fileStream.bad()) { - ec = make_error_code(static_cast(errno)); + ec = make_error_code(static_cast(errno)); return; } } diff --git a/src/libxrpl/basics/Log.cpp b/src/libxrpl/basics/Log.cpp index e855e1006b..06489fd779 100644 --- a/src/libxrpl/basics/Log.cpp +++ b/src/libxrpl/basics/Log.cpp @@ -5,10 +5,10 @@ #include #include -#include #include #include +#include #include #include #include @@ -53,7 +53,7 @@ Logs::File::isOpen() const noexcept } bool -Logs::File::open(boost::filesystem::path const& path) +Logs::File::open(std::filesystem::path const& path) { close(); @@ -112,7 +112,7 @@ Logs::Logs(beast::severities::Severity thresh) : thresh_(thresh) // default sev } bool -Logs::open(boost::filesystem::path const& pathToLogFile) +Logs::open(std::filesystem::path const& pathToLogFile) { return file_.open(pathToLogFile); } diff --git a/src/libxrpl/nodestore/backend/NuDBFactory.cpp b/src/libxrpl/nodestore/backend/NuDBFactory.cpp index 7fb3aec843..b86f73af50 100644 --- a/src/libxrpl/nodestore/backend/NuDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/NuDBFactory.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include + +#include #include #include @@ -131,7 +131,7 @@ public: void open(bool createIfMissing, uint64_t appType, uint64_t uid, uint64_t salt) override { - using namespace boost::filesystem; + using namespace std::filesystem; if (db_.is_open()) { // LCOV_EXCL_START @@ -194,11 +194,12 @@ public: if (deletePath_) { - boost::filesystem::remove_all(name_, ec); - if (ec) + std::error_code fsec; + std::filesystem::remove_all(name_, fsec); + if (fsec) { JLOG(j_.fatal()) - << "Filesystem remove_all of " << name_ << " failed with: " << ec.message(); + << "Filesystem remove_all of " << name_ << " failed with: " << fsec.message(); } } } @@ -374,7 +375,7 @@ private: static std::size_t parseBlockSize(std::string const& name, Section const& keyValues, beast::Journal journal) { - using namespace boost::filesystem; + using namespace std::filesystem; auto const folder = path(name); auto const kp = (folder / "nudb.key").string(); diff --git a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp index 3e0957edea..5780ce0236 100644 --- a/src/libxrpl/nodestore/backend/RocksDBFactory.cpp +++ b/src/libxrpl/nodestore/backend/RocksDBFactory.cpp @@ -8,8 +8,8 @@ #include #include -#include -#include + +#include #include #include @@ -265,8 +265,8 @@ public: m_db.reset(); if (m_deletePath) { - boost::filesystem::path const dir = m_name; - boost::filesystem::remove_all(dir); + std::filesystem::path const dir = m_name; + std::filesystem::remove_all(dir); } } } diff --git a/src/libxrpl/rdb/SociDB.cpp b/src/libxrpl/rdb/SociDB.cpp index c6e40ae90b..85276f8556 100644 --- a/src/libxrpl/rdb/SociDB.cpp +++ b/src/libxrpl/rdb/SociDB.cpp @@ -4,13 +4,9 @@ #include #include -#include -#include - -#include - #include #include +#include #include #include #include @@ -44,7 +40,7 @@ getSociSqliteInit(std::string const& name, std::string const& dir, std::string c Throw( "Sqlite databases must specify a dir and a name. Name: " + name + " Dir: " + dir); } - boost::filesystem::path file(dir); + std::filesystem::path file(dir); if (is_directory(file)) file /= name + ext; return file.string(); diff --git a/src/libxrpl/server/Vacuum.cpp b/src/libxrpl/server/Vacuum.cpp index d0e430ead9..99f3462fc3 100644 --- a/src/libxrpl/server/Vacuum.cpp +++ b/src/libxrpl/server/Vacuum.cpp @@ -5,13 +5,12 @@ #include #include -#include -#include #include // IWYU pragma: keep #include #include +#include #include #include @@ -20,7 +19,7 @@ namespace xrpl { bool doVacuumDB(DatabaseCon::Setup const& setup, beast::Journal j) { - boost::filesystem::path const dbPath = setup.dataDir / TxDBName; + std::filesystem::path const dbPath = setup.dataDir / TxDBName; uintmax_t const dbSize = file_size(dbPath); XRPL_ASSERT(dbSize != static_cast(-1), "xrpl::doVacuumDB : file_size succeeded"); diff --git a/src/test/app/GRPCServerTLS_test.cpp b/src/test/app/GRPCServerTLS_test.cpp index a3411682a2..cdfd6c75a3 100644 --- a/src/test/app/GRPCServerTLS_test.cpp +++ b/src/test/app/GRPCServerTLS_test.cpp @@ -7,8 +7,6 @@ #include #include -#include - #include #include #include @@ -18,7 +16,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -256,9 +257,12 @@ public: TemporaryTLSCertificates() { auto tmpDir = std::filesystem::temp_directory_path(); - auto uniqueDirName = - boost::filesystem::unique_path(std::string(kCERTS_DIR_PREFIX) + "%%%%%%%%"); - tempDir_ = tmpDir / uniqueDirName.string(); + // Generate 8 random hex characters to create a unique directory name + std::random_device rd; + std::ostringstream oss; + oss << kCERTS_DIR_PREFIX << std::hex << std::setfill('0') << std::setw(8) + << (rd() & 0xFFFFFFFF); + tempDir_ = tmpDir / oss.str(); std::filesystem::create_directories(tempDir_); writeFile(tempDir_ / kCA_CERT_FILENAME, kCA_CERT_CONTENT); diff --git a/src/test/app/LedgerLoad_test.cpp b/src/test/app/LedgerLoad_test.cpp index a97b492921..8510dabc1f 100644 --- a/src/test/app/LedgerLoad_test.cpp +++ b/src/test/app/LedgerLoad_test.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include @@ -139,7 +139,7 @@ class LedgerLoad_test : public beast::unit_test::suite { testcase("Load ledger: Bad Files"); using namespace test::jtx; - using namespace boost::filesystem; + using namespace std::filesystem; // empty path except([&] { @@ -162,7 +162,7 @@ class LedgerLoad_test : public beast::unit_test::suite // make a corrupted version of the ledger file (last 10 bytes removed). boost::system::error_code ec; - auto ledgerFileCorrupt = boost::filesystem::path{sd.dbPath} / "ledgerdata_bad.json"; + auto ledgerFileCorrupt = std::filesystem::path{sd.dbPath} / "ledgerdata_bad.json"; copy_file(sd.ledgerFile, ledgerFileCorrupt, copy_options::overwrite_existing, ec); if (!BEAST_EXPECTS(!ec, ec.message())) return; diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index 1025b73fe8..716de8b6e0 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -21,8 +21,8 @@ #include #include -#include -#include + +#include #include #include @@ -55,18 +55,18 @@ private: } static void - cleanupDatabaseDir(boost::filesystem::path const& dbPath) + cleanupDatabaseDir(std::filesystem::path const& dbPath) { - using namespace boost::filesystem; + using namespace std::filesystem; if (!exists(dbPath) || !is_directory(dbPath) || !is_empty(dbPath)) return; remove(dbPath); } static void - setupDatabaseDir(boost::filesystem::path const& dbPath) + setupDatabaseDir(std::filesystem::path const& dbPath) { - using namespace boost::filesystem; + using namespace std::filesystem; if (!exists(dbPath)) { create_directory(dbPath); @@ -79,10 +79,10 @@ private: Throw("Cannot create directory: " + dbPath.string()); } } - static boost::filesystem::path + static std::filesystem::path getDatabasePath() { - return boost::filesystem::current_path() / "manifest_test_databases"; + return std::filesystem::current_path() / "manifest_test_databases"; } public: @@ -351,7 +351,7 @@ public: BEAST_EXPECT(loaded.revoked(pk)); } } - boost::filesystem::remove(getDatabasePath() / boost::filesystem::path(dbName)); + std::filesystem::remove(getDatabasePath() / std::filesystem::path(dbName)); } void diff --git a/src/test/app/SHAMapStore_test.cpp b/src/test/app/SHAMapStore_test.cpp index 75e4c0c721..2ebfe70e3e 100644 --- a/src/test/app/SHAMapStore_test.cpp +++ b/src/test/app/SHAMapStore_test.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -491,7 +491,7 @@ public: makeBackendRotating(jtx::Env& env, NodeStoreScheduler& scheduler, std::string path) { Section section{env.app().config().section(ConfigSection::nodeDatabase())}; - boost::filesystem::path newPath; + std::filesystem::path newPath; if (!BEAST_EXPECT(path.size())) return {}; diff --git a/src/test/app/ValidatorSite_test.cpp b/src/test/app/ValidatorSite_test.cpp index f652689b2b..a20ced7d3b 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include + +#include #include #include @@ -601,7 +601,7 @@ public: detail::default_effective_overlap, 60 * 24}}); // max of 24 hours } - using namespace boost::filesystem; + using namespace std::filesystem; for (auto const& file : directory_iterator(good.subdir())) { remove_all(file); diff --git a/src/test/basics/FileUtilities_test.cpp b/src/test/basics/FileUtilities_test.cpp index b427e800ec..18545a2544 100644 --- a/src/test/basics/FileUtilities_test.cpp +++ b/src/test/basics/FileUtilities_test.cpp @@ -4,8 +4,7 @@ #include #include -#include -#include +#include namespace xrpl { @@ -16,14 +15,13 @@ public: testGetFileContents() { using namespace xrpl::detail; - using namespace boost::system; constexpr char const* expectedContents = "This file is very short. That's all we need."; FileDirGuard const file( *this, "test_file", "test.txt", "This is temporary text that should get overwritten"); - error_code ec; + std::error_code ec; auto const path = file.file(); writeFileContents(ec, path, expectedContents); @@ -46,7 +44,7 @@ public: { // Test with small max auto const bad = getFileContents(ec, path, 16); - BEAST_EXPECT(ec && ec.value() == boost::system::errc::file_too_large); + BEAST_EXPECT(ec && ec.value() == static_cast(std::errc::file_too_large)); BEAST_EXPECT(bad.empty()); } } diff --git a/src/test/basics/PerfLog_test.cpp b/src/test/basics/PerfLog_test.cpp index cd00b180e7..8e53103852 100644 --- a/src/test/basics/PerfLog_test.cpp +++ b/src/test/basics/PerfLog_test.cpp @@ -15,14 +15,10 @@ #include #include -#include -#include -#include -#include - #include #include #include +#include #include #include #include @@ -31,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +40,7 @@ class PerfLog_test : public beast::unit_test::suite { enum class WithFile : bool { no = false, yes = true }; - using path = boost::filesystem::path; + using path = std::filesystem::path; // We're only using Env for its Journal. That Journal gives better // coverage in unit tests. @@ -62,7 +59,7 @@ class PerfLog_test : public beast::unit_test::suite ~Fixture() { - using namespace boost::filesystem; + using namespace std::filesystem; auto const dir{logDir()}; auto const file{logFile()}; @@ -85,7 +82,7 @@ class PerfLog_test : public beast::unit_test::suite static path logDir() { - using namespace boost::filesystem; + using namespace std::filesystem; return temp_directory_path() / "perf_log_test_dir"; } @@ -118,7 +115,7 @@ class PerfLog_test : public beast::unit_test::suite static void wait() { - using namespace boost::filesystem; + using namespace std::filesystem; auto const path = logFile(); if (!exists(path)) @@ -190,7 +187,7 @@ public: void testFileCreation() { - using namespace boost::filesystem; + using namespace std::filesystem; { // Verify a PerfLog creates its file when constructed. @@ -245,22 +242,23 @@ public: // Construct and write protect a file to prevent PerfLog // from creating its file. - boost::system::error_code ec; - boost::filesystem::create_directories(fixture.logDir(), ec); + std::error_code ec; + std::filesystem::create_directories(fixture.logDir(), ec); if (!BEAST_EXPECT(!ec)) return; - auto fileWriteable = [](boost::filesystem::path const& p) -> bool { + auto fileWriteable = [](std::filesystem::path const& p) -> bool { return std::ofstream{p.c_str(), std::ios::out | std::ios::app}.is_open(); }; if (!BEAST_EXPECT(fileWriteable(fixture.logFile()))) return; - boost::filesystem::permissions( + std::filesystem::permissions( fixture.logFile(), - perms::remove_perms | perms::owner_write | perms::others_write | - perms::group_write); + std::filesystem::perms::owner_write | std::filesystem::perms::others_write | + std::filesystem::perms::group_write, + std::filesystem::perm_options::remove); // If the test is running as root, then the write protect may have // no effect. Make sure write protect worked before proceeding. @@ -284,9 +282,11 @@ public: perfLog->stop(); // Fix file permissions so the file can be cleaned up. - boost::filesystem::permissions( + std::filesystem::permissions( fixture.logFile(), - perms::add_perms | perms::owner_write | perms::others_write | perms::group_write); + std::filesystem::perms::owner_write | std::filesystem::perms::others_write | + std::filesystem::perms::group_write, + std::filesystem::perm_options::add); } } @@ -951,7 +951,7 @@ public: // We can't fully test rotate because unit tests must run on Windows, // and Windows doesn't (may not?) support rotate. But at least call // the interface and see that it doesn't crash. - using namespace boost::filesystem; + using namespace std::filesystem; Fixture fixture{env_.app(), j_}; BEAST_EXPECT(!exists(fixture.logDir())); diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index 569a31df60..27d5be44f5 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -10,7 +10,7 @@ #include // IWYU pragma: keep #include -#include +#include #include // IWYU pragma: keep #include #include @@ -179,7 +179,7 @@ public: bool dataDirExists() const { - return boost::filesystem::is_directory(dataDir_); + return std::filesystem::is_directory(dataDir_); } bool @@ -192,7 +192,7 @@ public: { try { - using namespace boost::filesystem; + using namespace std::filesystem; if (rmDataDir_) rmDir(dataDir_); } @@ -273,7 +273,7 @@ public: class Config_test final : public TestSuite { private: - using path = boost::filesystem::path; + using path = std::filesystem::path; public: void @@ -308,7 +308,7 @@ port_wss_admin { testcase("config_file"); - using namespace boost::filesystem; + using namespace std::filesystem; auto const cwd = current_path(); // Test both config file names. @@ -424,7 +424,7 @@ port_wss_admin { testcase("database_path"); - using namespace boost::filesystem; + using namespace std::filesystem; { boost::format cc("[database_path]\n%1%\n"); @@ -600,7 +600,7 @@ main { testcase("validators_file"); - using namespace boost::filesystem; + using namespace std::filesystem; { // load should throw for missing specified validators file boost::format cc("[validators_file]\n%1%\n"); diff --git a/src/test/core/SociDB_test.cpp b/src/test/core/SociDB_test.cpp index 29aeca7ce5..b4a7ebe8df 100644 --- a/src/test/core/SociDB_test.cpp +++ b/src/test/core/SociDB_test.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include + +#include #include #include @@ -30,7 +30,7 @@ class SociDB_test final : public TestSuite { private: static void - setupSQLiteConfig(BasicConfig& config, boost::filesystem::path const& dbPath) + setupSQLiteConfig(BasicConfig& config, std::filesystem::path const& dbPath) { config.overwrite("sqdb", "backend", "sqlite"); auto value = dbPath.string(); @@ -39,18 +39,18 @@ private: } static void - cleanupDatabaseDir(boost::filesystem::path const& dbPath) + cleanupDatabaseDir(std::filesystem::path const& dbPath) { - using namespace boost::filesystem; + using namespace std::filesystem; if (!exists(dbPath) || !is_directory(dbPath) || !is_empty(dbPath)) return; remove(dbPath); } static void - setupDatabaseDir(boost::filesystem::path const& dbPath) + setupDatabaseDir(std::filesystem::path const& dbPath) { - using namespace boost::filesystem; + using namespace std::filesystem; if (!exists(dbPath)) { create_directory(dbPath); @@ -63,10 +63,10 @@ private: Throw("Cannot create directory: " + dbPath.string()); } } - static boost::filesystem::path + static std::filesystem::path getDatabasePath() { - return boost::filesystem::current_path() / "socidb_test_databases"; + return std::filesystem::current_path() / "socidb_test_databases"; } public: @@ -156,7 +156,7 @@ public: checkValues(s); } { - namespace bfs = boost::filesystem; + namespace bfs = std::filesystem; // Remove the database bfs::path const dbPath(sc.connectionString()); if (bfs::is_regular_file(dbPath)) @@ -286,7 +286,7 @@ public: #endif } { - namespace bfs = boost::filesystem; + namespace bfs = std::filesystem; // Remove the database bfs::path const dbPath(sc.connectionString()); if (bfs::is_regular_file(dbPath)) @@ -338,7 +338,7 @@ public: s << "SELECT LedgerSeq FROM Ledgers;", soci::into(ledgersLS); BEAST_EXPECT(ledgersLS.size() == numRows); } - namespace bfs = boost::filesystem; + namespace bfs = std::filesystem; // Remove the database bfs::path const dbPath(sc.connectionString()); if (bfs::is_regular_file(dbPath)) diff --git a/src/test/unit_test/FileDirGuard.h b/src/test/unit_test/FileDirGuard.h index 9d4b94d8c5..22dcd7f942 100644 --- a/src/test/unit_test/FileDirGuard.h +++ b/src/test/unit_test/FileDirGuard.h @@ -4,8 +4,7 @@ #include -#include - +#include #include namespace xrpl::detail { @@ -16,7 +15,7 @@ namespace xrpl::detail { class DirGuard { protected: - using path = boost::filesystem::path; + using path = std::filesystem::path; private: path subDir_; @@ -43,7 +42,7 @@ public: DirGuard(beast::unit_test::suite& test, path subDir, bool useCounter = true) : subDir_(std::move(subDir)), test_(test) { - using namespace boost::filesystem; + using namespace std::filesystem; static auto subDirCounter = 0; if (useCounter) @@ -69,7 +68,7 @@ public: { try { - using namespace boost::filesystem; + using namespace std::filesystem; if (rmSubDir_) rmDir(subDir_); @@ -126,7 +125,7 @@ public: { try { - using namespace boost::filesystem; + using namespace std::filesystem; if (exists(file_)) { remove(file_); @@ -156,7 +155,7 @@ public: bool fileExists() const { - return boost::filesystem::exists(file_); + return std::filesystem::exists(file_); } }; diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 3c64606516..e8b2b2ddfb 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -613,7 +613,7 @@ GRPCServerImpl::createServerCredentials() try { - boost::system::error_code ec; + std::error_code ec; grpc::SslServerCredentialsOptions sslOpts; grpc::SslServerCredentialsOptions::PemKeyCertPair keyCertPair; diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 518d9f6b14..b002178ae9 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -24,17 +24,18 @@ #include #include -#include -#include -#include #include #include +#include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -368,11 +369,11 @@ void SHAMapStoreImp::dbPaths() { Section const section{app_.config().section(ConfigSection::nodeDatabase())}; - boost::filesystem::path dbPath = get(section, "path"); + std::filesystem::path dbPath = get(section, "path"); - if (boost::filesystem::exists(dbPath)) + if (std::filesystem::exists(dbPath)) { - if (!boost::filesystem::is_directory(dbPath)) + if (!std::filesystem::is_directory(dbPath)) { journal_.error() << "node db path must be a directory. " << dbPath.string(); Throw("node db path must be a directory."); @@ -380,7 +381,7 @@ SHAMapStoreImp::dbPaths() } else { - boost::filesystem::create_directories(dbPath); + std::filesystem::create_directories(dbPath); } SavedState state = state_db_.getState(); @@ -391,8 +392,8 @@ SHAMapStoreImp::dbPaths() return false; // Check if configured "path" matches stored directory path - using namespace boost::filesystem; - auto const stored{path(sPath)}; + using namespace std::filesystem; + auto const stored{std::filesystem::path(sPath)}; if (stored.parent_path() == dbPath) return false; @@ -410,9 +411,9 @@ SHAMapStoreImp::dbPaths() bool writableDbExists = false; bool archiveDbExists = false; - std::vector pathsToDelete; - for (boost::filesystem::directory_iterator it(dbPath); - it != boost::filesystem::directory_iterator(); + std::vector pathsToDelete; + for (std::filesystem::directory_iterator it(dbPath); + it != std::filesystem::directory_iterator(); ++it) { if (state.writableDb.compare(it->path().string()) == 0) @@ -433,7 +434,7 @@ SHAMapStoreImp::dbPaths() (!archiveDbExists && !state.archiveDb.empty()) || (writableDbExists != archiveDbExists) || state.writableDb.empty() != state.archiveDb.empty()) { - boost::filesystem::path stateDbPathName = app_.config().legacy("database_path"); + std::filesystem::path stateDbPathName = app_.config().legacy("database_path"); stateDbPathName /= dbName_; stateDbPathName += "*"; @@ -455,15 +456,15 @@ SHAMapStoreImp::dbPaths() } // The necessary directories exist. Now, remove any others. - for (boost::filesystem::path const& p : pathsToDelete) - boost::filesystem::remove_all(p); + for (std::filesystem::path const& p : pathsToDelete) + std::filesystem::remove_all(p); } std::unique_ptr SHAMapStoreImp::makeBackendRotating(std::string path) { Section section{app_.config().section(ConfigSection::nodeDatabase())}; - boost::filesystem::path newPath; + std::filesystem::path newPath; if (!path.empty()) { @@ -471,10 +472,13 @@ SHAMapStoreImp::makeBackendRotating(std::string path) } else { - boost::filesystem::path p = get(section, "path"); + std::filesystem::path p = get(section, "path"); p /= dbPrefix_; - p += ".%%%%"; - newPath = boost::filesystem::unique_path(p); + // Generate 4 random hex characters to create a unique path + std::random_device rd; + std::ostringstream oss; + oss << std::hex << std::setfill('0') << std::setw(4) << (rd() & 0xFFFF); + newPath = p.string() + "." + oss.str(); } section.set("path", newPath.string()); diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index ff5aa8c71f..21b9131967 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -12,6 +12,7 @@ #include +#include #include #include @@ -204,7 +205,7 @@ class ValidatorList ManifestCache& validatorManifests_; ManifestCache& publisherManifests_; TimeKeeper& timeKeeper_; - boost::filesystem::path const dataPath_; + std::filesystem::path const dataPath_; beast::Journal const j_; std::shared_mutex mutable mutex_; using lock_guard = std::lock_guard; @@ -803,7 +804,7 @@ private: /** Get the filename used for caching UNLs */ - boost::filesystem::path + std::filesystem::path getCacheFileName(lock_guard const&, PublicKey const& pubKey) const; /** Build a Json representation of the collection, suitable for diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 8a62a71972..90b590b589 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -29,12 +29,13 @@ #include #include -#include +#include +#include #include #include -#include -#include -#include + + + #include @@ -288,7 +289,7 @@ ValidatorList::load( return true; } -boost::filesystem::path +std::filesystem::path ValidatorList::getCacheFileName(ValidatorList::lock_guard const&, PublicKey const& pubKey) const { return dataPath_ / (filePrefix_ + strHex(pubKey)); @@ -372,9 +373,9 @@ ValidatorList::cacheValidatorFile(ValidatorList::lock_guard const& lock, PublicK if (dataPath_.empty()) return; - boost::filesystem::path const filename = getCacheFileName(lock, pubKey); + std::filesystem::path const filename = getCacheFileName(lock, pubKey); - boost::system::error_code ec; + std::error_code ec; Json::Value value = buildFileData(strHex(pubKey), publisherLists_.at(pubKey), j_); // xrpld should be the only process writing to this file, so @@ -1283,8 +1284,7 @@ std::vector ValidatorList::loadLists() { using namespace std::string_literals; - using namespace boost::filesystem; - using namespace boost::system::errc; + using namespace std::filesystem; std::lock_guard const lock{mutex_}; @@ -1292,12 +1292,12 @@ ValidatorList::loadLists() sites.reserve(publisherLists_.size()); for (auto const& [pubKey, publisherCollection] : publisherLists_) { - boost::system::error_code ec; + std::error_code ec; if (publisherCollection.status == PublisherStatus::available) continue; - boost::filesystem::path const filename = getCacheFileName(lock, pubKey); + std::filesystem::path const filename = getCacheFileName(lock, pubKey); auto const fullPath{canonical(filename, ec)}; if (ec) @@ -1308,7 +1308,7 @@ ValidatorList::loadLists() { // Treat an empty file as a missing file, because // nobody else is going to write it. - ec = make_error_code(no_such_file_or_directory); + ec = make_error_code(std::errc::no_such_file_or_directory); } if (ec) continue; diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index f1b5f4edc3..e916483860 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -37,10 +37,11 @@ #include #include -#include +#include +#include #include #include -#include + #include #include @@ -1290,8 +1291,8 @@ getTransaction( bool dbHasSpace(soci::session& session, Config const& config, beast::Journal j) { - boost::filesystem::space_info const space = - boost::filesystem::space(config.legacy("database_path")); + std::filesystem::space_info const space = + std::filesystem::space(config.legacy("database_path")); if (space.available < megabytes(512)) { @@ -1302,9 +1303,9 @@ dbHasSpace(soci::session& session, Config const& config, beast::Journal j) if (config.useTxTables()) { DatabaseCon::Setup const dbSetup = setup_DatabaseCon(config); - boost::filesystem::path const dbPath = dbSetup.dataDir / TxDBName; - boost::system::error_code ec; - std::optional dbSize = boost::filesystem::file_size(dbPath, ec); + std::filesystem::path const dbPath = dbSetup.dataDir / TxDBName; + std::error_code ec; + std::optional dbSize = std::filesystem::file_size(dbPath, ec); if (ec) { JLOG(j.error()) << "Error checking transaction db file size: " << ec.message(); diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index d4d8396ba5..7284449859 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -9,7 +9,7 @@ #include // VFALCO Breaks levelization #include -#include // VFALCO FIX: This include should not be here +#include // VFALCO FIX: This include should not be here #include #include @@ -82,17 +82,17 @@ public: static char const* const validatorsFileName; /** Returns the full path and filename of the debug log file. */ - boost::filesystem::path + std::filesystem::path getDebugLogFile() const; private: - boost::filesystem::path CONFIG_FILE; + std::filesystem::path CONFIG_FILE; public: - boost::filesystem::path CONFIG_DIR; + std::filesystem::path CONFIG_DIR; private: - boost::filesystem::path DEBUG_LOGFILE; + std::filesystem::path DEBUG_LOGFILE; void load(); diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index b7063287bb..5f3a2c6249 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -22,15 +22,16 @@ #include #include #include -#include -#include + +#include +#include #include #include #include #include // IWYU pragma: keep #include #include -#include + #include #include @@ -313,13 +314,13 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand // directory, use the current working directory as the // config directory and that with "db" as the data // directory. - boost::filesystem::path dataDir; + std::filesystem::path dataDir; if (!strConf.empty()) { // --conf= : everything is relative that file. CONFIG_FILE = strConf; - CONFIG_DIR = boost::filesystem::absolute(CONFIG_FILE); + CONFIG_DIR = std::filesystem::absolute(CONFIG_FILE); CONFIG_DIR.remove_filename(); dataDir = CONFIG_DIR / databaseDirName; } @@ -330,13 +331,13 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand // Check if either of the config files exist in the current working // directory, in which case the databases will be stored in a // subdirectory. - CONFIG_DIR = boost::filesystem::current_path(); + CONFIG_DIR = std::filesystem::current_path(); dataDir = CONFIG_DIR / databaseDirName; CONFIG_FILE = CONFIG_DIR / configFileName; - if (boost::filesystem::exists(CONFIG_FILE)) + if (std::filesystem::exists(CONFIG_FILE)) break; CONFIG_FILE = CONFIG_DIR / configLegacyName; - if (boost::filesystem::exists(CONFIG_FILE)) + if (std::filesystem::exists(CONFIG_FILE)) break; // Check if the home directory is set, and optionally the XDG config @@ -363,10 +364,10 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand dataDir = strXdgDataHome + "/" + systemName(); CONFIG_DIR = strXdgConfigHome + "/" + systemName(); CONFIG_FILE = CONFIG_DIR / configFileName; - if (boost::filesystem::exists(CONFIG_FILE)) + if (std::filesystem::exists(CONFIG_FILE)) break; CONFIG_FILE = CONFIG_DIR / configLegacyName; - if (boost::filesystem::exists(CONFIG_FILE)) + if (std::filesystem::exists(CONFIG_FILE)) break; } @@ -374,7 +375,7 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand dataDir = "/var/opt/" + systemName(); CONFIG_DIR = "/etc/opt/" + systemName(); CONFIG_FILE = CONFIG_DIR / configFileName; - if (boost::filesystem::exists(CONFIG_FILE)) + if (std::filesystem::exists(CONFIG_FILE)) break; CONFIG_FILE = CONFIG_DIR / configLegacyName; } while (false); @@ -387,7 +388,7 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand std::string const dbPath(legacy("database_path")); if (!dbPath.empty()) { - dataDir = boost::filesystem::path(dbPath); + dataDir = std::filesystem::path(dbPath); } else if (RUN_STANDALONE) { @@ -397,13 +398,13 @@ Config::setup(std::string const& strConf, bool bQuiet, bool bSilent, bool bStand if (!dataDir.empty()) { - boost::system::error_code ec; - boost::filesystem::create_directories(dataDir, ec); + std::error_code ec; + std::filesystem::create_directories(dataDir, ec); if (ec) Throw(boost::str(boost::format("Can not create %s") % dataDir)); - legacy("database_path", boost::filesystem::absolute(dataDir).string()); + legacy("database_path", std::filesystem::absolute(dataDir).string()); } HTTPClient::initializeSSLContext( @@ -456,7 +457,7 @@ Config::load() if (!QUIET) std::cerr << "Loading: " << CONFIG_FILE << "\n"; - boost::system::error_code ec; + std::error_code ec; auto const fileContents = getFileContents(ec, CONFIG_FILE); if (ec) @@ -509,8 +510,8 @@ Config::loadFromString(std::string const& fileContents) std::string dbPath; if (getSingleSection(secConfig, "database_path", dbPath, j_)) { - boost::filesystem::path const p(dbPath); - legacy("database_path", boost::filesystem::absolute(p).string()); + std::filesystem::path const p(dbPath); + legacy("database_path", std::filesystem::absolute(p).string()); } } @@ -953,7 +954,7 @@ Config::loadFromString(std::string const& fileContents) // If no path was specified, then look for validators.txt // in the same directory as the config file, but don't complain // if we can't find it. - boost::filesystem::path validatorsFile; + std::filesystem::path validatorsFile; if (getSingleSection(secConfig, SECTION_VALIDATORS_FILE, strTemp, j_)) { @@ -968,7 +969,7 @@ Config::loadFromString(std::string const& fileContents) if (!validatorsFile.is_absolute() && !CONFIG_DIR.empty()) validatorsFile = CONFIG_DIR / validatorsFile; - if (!boost::filesystem::exists(validatorsFile)) + if (!std::filesystem::exists(validatorsFile)) { Throw( "The file specified in [" SECTION_VALIDATORS_FILE @@ -977,8 +978,8 @@ Config::loadFromString(std::string const& fileContents) validatorsFile.string()); } else if ( - !boost::filesystem::is_regular_file(validatorsFile) && - !boost::filesystem::is_symlink(validatorsFile)) + !std::filesystem::is_regular_file(validatorsFile) && + !std::filesystem::is_symlink(validatorsFile)) { Throw( "Invalid file specified in [" SECTION_VALIDATORS_FILE "]: " + @@ -991,24 +992,24 @@ Config::loadFromString(std::string const& fileContents) if (!validatorsFile.empty()) { - if (!boost::filesystem::exists(validatorsFile)) + if (!std::filesystem::exists(validatorsFile)) { validatorsFile.clear(); } else if ( - !boost::filesystem::is_regular_file(validatorsFile) && - !boost::filesystem::is_symlink(validatorsFile)) + !std::filesystem::is_regular_file(validatorsFile) && + !std::filesystem::is_symlink(validatorsFile)) { validatorsFile.clear(); } } } - if (!validatorsFile.empty() && boost::filesystem::exists(validatorsFile) && - (boost::filesystem::is_regular_file(validatorsFile) || - boost::filesystem::is_symlink(validatorsFile))) + if (!validatorsFile.empty() && std::filesystem::exists(validatorsFile) && + (std::filesystem::is_regular_file(validatorsFile) || + std::filesystem::is_symlink(validatorsFile))) { - boost::system::error_code ec; + std::error_code ec; auto const data = getFileContents(ec, validatorsFile); if (ec) { @@ -1134,7 +1135,7 @@ Config::loadFromString(std::string const& fileContents) } } -boost::filesystem::path +std::filesystem::path Config::getDebugLogFile() const { auto log_file = DEBUG_LOGFILE; @@ -1143,17 +1144,17 @@ Config::getDebugLogFile() const { // Unless an absolute path for the log file is specified, the // path is relative to the config file directory. - log_file = boost::filesystem::absolute(log_file, CONFIG_DIR); + log_file = CONFIG_DIR / log_file; } if (!log_file.empty()) { auto log_dir = log_file.parent_path(); - if (!boost::filesystem::is_directory(log_dir)) + if (!std::filesystem::is_directory(log_dir)) { - boost::system::error_code ec; - boost::filesystem::create_directories(log_dir, ec); + std::error_code ec; + std::filesystem::create_directories(log_dir, ec); // If we fail, we warn but continue so that the calling code can // decide how to handle this situation. diff --git a/src/xrpld/perflog/detail/PerfLogImp.cpp b/src/xrpld/perflog/detail/PerfLogImp.cpp index 6b80d29cc6..b492dcc508 100644 --- a/src/xrpld/perflog/detail/PerfLogImp.cpp +++ b/src/xrpld/perflog/detail/PerfLogImp.cpp @@ -13,8 +13,9 @@ #include #include -#include -#include +#include +#include + #include #include @@ -216,10 +217,10 @@ PerfLogImp::openLog() logFile_.close(); auto logDir = setup_.perfLog.parent_path(); - if (!boost::filesystem::is_directory(logDir)) + if (!std::filesystem::is_directory(logDir)) { - boost::system::error_code ec; - boost::filesystem::create_directories(logDir, ec); + std::error_code ec; + std::filesystem::create_directories(logDir, ec); if (ec) { JLOG(j_.fatal()) << "Unable to create performance log " @@ -474,17 +475,17 @@ PerfLogImp::stop() //----------------------------------------------------------------------------- PerfLog::Setup -setup_PerfLog(Section const& section, boost::filesystem::path const& configDir) +setup_PerfLog(Section const& section, std::filesystem::path const& configDir) { PerfLog::Setup setup; std::string perfLog; set(perfLog, "perf_log", section); if (!perfLog.empty()) { - setup.perfLog = boost::filesystem::path(perfLog); + setup.perfLog = std::filesystem::path(perfLog); if (setup.perfLog.is_relative()) { - setup.perfLog = boost::filesystem::absolute(setup.perfLog, configDir); + setup.perfLog = configDir / setup.perfLog; } }