diff --git a/src/util/newconfig/ConfigFileJson.cpp b/src/util/newconfig/ConfigFileJson.cpp index ada59e09a..775202177 100644 --- a/src/util/newconfig/ConfigFileJson.cpp +++ b/src/util/newconfig/ConfigFileJson.cpp @@ -34,10 +34,9 @@ #include #include #include +#include #include #include -#include -#include #include #include #include @@ -82,7 +81,7 @@ ConfigFileJson::ConfigFileJson(boost::json::object jsonObj) } std::expected -ConfigFileJson::makeConfigFileJson(boost::filesystem::path configFilePath) +ConfigFileJson::makeConfigFileJson(std::filesystem::path const& configFilePath) { try { if (auto const in = std::ifstream(configFilePath.string(), std::ios::in | std::ios::binary); in) { diff --git a/src/util/newconfig/ConfigFileJson.hpp b/src/util/newconfig/ConfigFileJson.hpp index 83a3b6588..c208a334b 100644 --- a/src/util/newconfig/ConfigFileJson.hpp +++ b/src/util/newconfig/ConfigFileJson.hpp @@ -23,10 +23,10 @@ #include "util/newconfig/Error.hpp" #include "util/newconfig/Types.hpp" -#include #include #include +#include #include #include #include @@ -79,7 +79,7 @@ public: * @return A ConfigFileJson object if parsing user file is successful. Error otherwise */ [[nodiscard]] static std::expected - makeConfigFileJson(boost::filesystem::path configFilePath); + makeConfigFileJson(std::filesystem::path const& configFilePath); private: /** diff --git a/tests/unit/ConfigTests.cpp b/tests/unit/ConfigTests.cpp index 975b8cfb9..ca21fa333 100644 --- a/tests/unit/ConfigTests.cpp +++ b/tests/unit/ConfigTests.cpp @@ -19,6 +19,7 @@ #include "util/Assert.hpp" #include "util/LoggerFixtures.hpp" +#include "util/TmpFile.hpp" #include "util/config/Config.hpp" #include @@ -29,8 +30,6 @@ #include #include -#include -#include #include #include #include @@ -236,36 +235,10 @@ TEST_F(ConfigTest, Extend) ASSERT_EQ(custom.c, true); } -/** - * @brief Simple temporary file util - */ -class TmpFile { -public: - TmpFile(std::string const& data) : tmpPath_{boost::filesystem::unique_path().string()} - { - std::ofstream of; - of.open(tmpPath_); - of << data; - of.close(); - } - ~TmpFile() - { - std::remove(tmpPath_.c_str()); - } - std::string - path() const - { - return tmpPath_; - } - -private: - std::string tmpPath_; -}; - TEST_F(ConfigTest, File) { auto tmp = TmpFile(kJSON_DATA); - auto conf = ConfigReader::open(tmp.path()); + auto conf = ConfigReader::open(tmp.path); ASSERT_EQ(conf.value("top"), 420);