diff --git a/include/xrpl/basics/FileUtilities.h b/include/xrpl/basics/FileUtilities.h index 294fe3e979..3c2b5858fe 100644 --- a/include/xrpl/basics/FileUtilities.h +++ b/include/xrpl/basics/FileUtilities.h @@ -1,18 +1,10 @@ #pragma once -<<<<<<< HEAD +#include #include #include #include #include -======= -#include -#include - -#include -#include -#include ->>>>>>> origin/develop namespace xrpl { diff --git a/include/xrpl/beast/unit_test/suite.h b/include/xrpl/beast/unit_test/suite.h index e2ae7e16e0..c08001e827 100644 --- a/include/xrpl/beast/unit_test/suite.h +++ b/include/xrpl/beast/unit_test/suite.h @@ -9,12 +9,9 @@ #include #include -<<<<<<< HEAD -#include -======= #include +#include #include ->>>>>>> origin/develop #include #include #include diff --git a/include/xrpl/beast/utility/temp_dir.h b/include/xrpl/beast/utility/temp_dir.h index 0af91445d4..44d568344a 100644 --- a/include/xrpl/beast/utility/temp_dir.h +++ b/include/xrpl/beast/utility/temp_dir.h @@ -10,14 +10,14 @@ namespace beast { -<<<<<<< HEAD -/** Generate a unique, non-existing path under @p base with an optional @p prefix - and a random hex suffix. - - Attempts up to @p maxAttempts paths. Throws `std::runtime_error` if a - unique path cannot be found or if the filesystem returns an error while - checking for existence. -*/ +/** + * Generate a unique, non-existing path under @p base with an optional @p prefix + * and a random hex suffix. + * + * Attempts up to @p maxAttempts paths. Throws `std::runtime_error` if a + * unique path cannot be found or if the filesystem returns an error while + * checking for existence. + */ inline std::filesystem::path uniqueRandomPath( std::filesystem::path const& base, @@ -44,19 +44,12 @@ uniqueRandomPath( throw std::runtime_error("Unable to generate a unique path under '" + base.string() + "'"); } -/** RAII temporary directory. - - The directory and all its contents are deleted when - the instance of `TempDir` is destroyed. -*/ -======= /** * RAII temporary directory. * * The directory and all its contents are deleted when - * the instance of `temp_dir` is destroyed. + * the instance of `TempDir` is destroyed. */ ->>>>>>> origin/develop class TempDir { std::filesystem::path path_; diff --git a/include/xrpl/rdb/DatabaseCon.h b/include/xrpl/rdb/DatabaseCon.h index df9ad859f9..5c20f65784 100644 --- a/include/xrpl/rdb/DatabaseCon.h +++ b/include/xrpl/rdb/DatabaseCon.h @@ -6,19 +6,14 @@ #include #include -<<<<<<< HEAD -#include -======= -#include - #include #include #include #include +#include #include #include ->>>>>>> origin/develop #include #include #include diff --git a/include/xrpl/server/State.h b/include/xrpl/server/State.h index 6d96cb7632..d15b2265fb 100644 --- a/include/xrpl/server/State.h +++ b/include/xrpl/server/State.h @@ -4,13 +4,9 @@ #include #include -<<<<<<< HEAD -======= -#include - #include ->>>>>>> origin/develop + namespace xrpl { struct SavedState diff --git a/src/test/basics/FileUtilities_test.cpp b/src/test/basics/FileUtilities_test.cpp deleted file mode 100644 index 37ec89ef20..0000000000 --- a/src/test/basics/FileUtilities_test.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include - -#include -#include -#include - -#include - -namespace xrpl { - -class FileUtilities_test : public beast::unit_test::Suite -{ -public: - void - testGetFileContents() - { - using namespace xrpl::detail; - - static constexpr char const* kExpectedContents = - "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"); - - std::error_code ec; - auto const path = file.file(); - - writeFileContents(ec, path, kExpectedContents); - BEAST_EXPECT(!ec); - - { - // Test with no max - auto const good = getFileContents(ec, path); - BEAST_EXPECT(!ec); - BEAST_EXPECT(good == kExpectedContents); - } - - { - // Test with large max - auto const good = getFileContents(ec, path, kilobytes(1)); - BEAST_EXPECT(!ec); - BEAST_EXPECT(good == kExpectedContents); - } - - { - // Test with small max - auto const bad = getFileContents(ec, path, 16); - BEAST_EXPECT(ec && ec == std::errc::file_too_large); - BEAST_EXPECT(bad.empty()); - } - } - - void - run() override - { - testGetFileContents(); - } -}; - -BEAST_DEFINE_TESTSUITE(FileUtilities, basics, xrpl); - -} // namespace xrpl diff --git a/src/test/core/SociDB_test.cpp b/src/test/core/SociDB_test.cpp index ef864238cf..1547f5e70a 100644 --- a/src/test/core/SociDB_test.cpp +++ b/src/test/core/SociDB_test.cpp @@ -7,8 +7,6 @@ #include #include -#include -#include #include // IWYU pragma: keep #include // IWYU pragma: keep diff --git a/src/test/unit_test/FileDirGuard.h b/src/test/unit_test/FileDirGuard.h index 90bb82a195..2e6b3fd179 100644 --- a/src/test/unit_test/FileDirGuard.h +++ b/src/test/unit_test/FileDirGuard.h @@ -3,13 +3,8 @@ #include #include -<<<<<<< HEAD -#include -======= -#include - #include ->>>>>>> origin/develop +#include #include #include #include diff --git a/src/tests/libxrpl/basics/FileUtilities.cpp b/src/tests/libxrpl/basics/FileUtilities.cpp index cd24abd696..6e9e8f402c 100644 --- a/src/tests/libxrpl/basics/FileUtilities.cpp +++ b/src/tests/libxrpl/basics/FileUtilities.cpp @@ -1,17 +1,16 @@ #include #include - -#include -#include -#include -#include +#include #include +#include +#include #include #include #include +#include namespace xrpl { @@ -20,15 +19,16 @@ namespace { class TempFile { public: - explicit TempFile(boost::filesystem::path file, std::string const& contents) - : dir_( - boost::filesystem::temp_directory_path() / - boost::filesystem::unique_path("xrpl-file-utilities-%%%%-%%%%-%%%%")) + explicit TempFile(std::filesystem::path file, std::string const& contents) + : dir_(beast::uniqueRandomPath( + std::filesystem::temp_directory_path(), + 100, + "xrpl-file-utilities-")) , file_(dir_ / file) { - boost::filesystem::create_directory(dir_); + std::filesystem::create_directory(dir_); - std::ofstream output(file_.string()); + std::ofstream output(file_); if (!output) throw std::runtime_error("Unable to create temporary test file"); @@ -37,33 +37,31 @@ public: ~TempFile() { - boost::system::error_code ec; - boost::filesystem::remove(file_, ec); - boost::filesystem::remove(dir_, ec); + std::error_code ec; + std::filesystem::remove(file_, ec); + std::filesystem::remove(dir_, ec); } - [[nodiscard]] boost::filesystem::path const& + [[nodiscard]] std::filesystem::path const& file() const { return file_; } private: - boost::filesystem::path dir_; - boost::filesystem::path file_; + std::filesystem::path dir_; + std::filesystem::path file_; }; } // namespace TEST(FileUtilitiesTest, get_file_contents) { - using namespace boost::system; - constexpr char const* kExpectedContents = "This file is very short. That's all we need."; TempFile const file("test_file", "This is temporary text that should get overwritten"); - error_code ec; + std::error_code ec; auto const path = file.file(); writeFileContents(ec, path, kExpectedContents); @@ -86,7 +84,7 @@ TEST(FileUtilitiesTest, get_file_contents) { // Test with small max auto const bad = getFileContents(ec, path, 16); - EXPECT_TRUE(ec && ec.value() == boost::system::errc::file_too_large); + EXPECT_TRUE(ec && ec.value() == static_cast(std::errc::file_too_large)); EXPECT_TRUE(bad.empty()); } } diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index f187df2604..abec6cf4e0 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -14,16 +14,13 @@ #include -<<<<<<< HEAD -#include -======= #include #include #include +#include #include #include #include ->>>>>>> origin/develop #include #include #include diff --git a/src/xrpld/core/Config.h b/src/xrpld/core/Config.h index 075fda56db..44c593bcd6 100644 --- a/src/xrpld/core/Config.h +++ b/src/xrpld/core/Config.h @@ -11,13 +11,8 @@ #include #include -<<<<<<< HEAD -======= -#include // VFALCO FIX: This include should not be here - #include #include ->>>>>>> origin/develop #include #include #include @@ -98,15 +93,10 @@ public: static char const* const kDatabaseDirName; static char const* const kValidatorsFileName; -<<<<<<< HEAD - /** Returns the full path and filename of the debug log file. */ - [[nodiscard]] std::filesystem::path -======= /** * Returns the full path and filename of the debug log file. */ - [[nodiscard]] boost::filesystem::path ->>>>>>> origin/develop + [[nodiscard]] std::filesystem::path getDebugLogFile() const; private: diff --git a/src/xrpld/core/detail/Config.cpp b/src/xrpld/core/detail/Config.cpp index 6c6351a81c..2076dce9b2 100644 --- a/src/xrpld/core/detail/Config.cpp +++ b/src/xrpld/core/detail/Config.cpp @@ -1013,19 +1013,9 @@ Config::loadFromString(std::string const& fileContents) if (!validatorsFile.empty()) { -<<<<<<< HEAD - if (!std::filesystem::exists(validatorsFile)) - { - validatorsFile.clear(); - } - else if ( - !std::filesystem::is_regular_file(validatorsFile) && - !std::filesystem::is_symlink(validatorsFile)) -======= - if (!boost::filesystem::exists(validatorsFile) || - (!boost::filesystem::is_regular_file(validatorsFile) && - !boost::filesystem::is_symlink(validatorsFile))) ->>>>>>> origin/develop + if (!std::filesystem::exists(validatorsFile) || + (!std::filesystem::is_regular_file(validatorsFile) && + !std::filesystem::is_symlink(validatorsFile))) { validatorsFile.clear(); }