diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-05 18:18:12 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-05 18:18:12 +0200 |
| commit | 7543163a4da54f7b9ca9813fc425baebdcaa2da9 (patch) | |
| tree | 94c4eba7fbd72c4f272895e1d9536a7884cfb5da | |
| parent | use regular `throw` instead of the Boost function (diff) | |
| download | winapi-debug-7543163a4da54f7b9ca9813fc425baebdcaa2da9.tar.gz winapi-debug-7543163a4da54f7b9ca9813fc425baebdcaa2da9.zip | |
upgrade to std::filesystem
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | test/unit_tests/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | test/unit_tests/fixtures.hpp | 3 | ||||
| -rw-r--r-- | test/unit_tests/paths.hpp | 9 | ||||
| -rw-r--r-- | utils/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | utils/command_line.hpp | 4 |
6 files changed, 12 insertions, 13 deletions
@@ -11,7 +11,7 @@ TOOLSET ?= mingw PLATFORM ?= auto CONFIGURATION ?= Debug BOOST_VERSION ?= 1.81.0 -BOOST_LIBRARIES := filesystem program_options test +BOOST_LIBRARIES := program_options test CMAKE_FLAGS ?= INSTALL_PREFIX ?= $(install_dir) diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt index 22053f1..41375b5 100644 --- a/test/unit_tests/CMakeLists.txt +++ b/test/unit_tests/CMakeLists.txt @@ -1,10 +1,9 @@ -find_package(Boost CONFIG REQUIRED COMPONENTS filesystem unit_test_framework) +find_package(Boost CONFIG REQUIRED COMPONENTS unit_test_framework) add_executable(unit_tests main.cpp call_stack.cpp dbghelp.cpp) target_link_libraries(unit_tests PRIVATE test_lib winapi_debug) target_link_libraries(unit_tests PRIVATE Boost::disable_autolinking - Boost::filesystem Boost::unit_test_framework) install(TARGETS unit_tests RUNTIME DESTINATION bin/test) if(MSVC) diff --git a/test/unit_tests/fixtures.hpp b/test/unit_tests/fixtures.hpp index 791ad01..8fe7e91 100644 --- a/test/unit_tests/fixtures.hpp +++ b/test/unit_tests/fixtures.hpp @@ -11,7 +11,6 @@ #include <winapi/debug.hpp> -#include <boost/filesystem.hpp> #include <boost/test/unit_test.hpp> #include <iterator> @@ -115,7 +114,7 @@ private: dbghelp.load_pdb(pdb_path); } - static boost::filesystem::path get_module_pdb_path() { + static std::filesystem::path get_module_pdb_path() { // That's pretty ad-hoc, but seems to work; based on // https://www.boost.org/doc/libs/1_70_0/libs/test/doc/html/boost_test/runtime_config/custom_command_line_arguments.html BOOST_TEST_REQUIRE(boost::unit_test::framework::master_test_suite().argc == 3); diff --git a/test/unit_tests/paths.hpp b/test/unit_tests/paths.hpp index f9494a6..4f7537a 100644 --- a/test/unit_tests/paths.hpp +++ b/test/unit_tests/paths.hpp @@ -5,14 +5,15 @@ #pragma once -#include <boost/filesystem.hpp> #include <boost/test/unit_test.hpp> -using path = boost::filesystem::path; +#include <filesystem> + +using path = std::filesystem::path; class Paths { public: - using path = boost::filesystem::path; + using path = std::filesystem::path; static Paths& get() { static Paths instance; @@ -27,7 +28,7 @@ public: private: static path get_executable_path() { const auto argv0 = boost::unit_test::framework::master_test_suite().argv[0]; - return boost::filesystem::system_complete(argv0); + return std::filesystem::absolute(argv0); } Paths(const Paths&) = delete; diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 9952377..ce0ec07 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,9 +1,9 @@ -find_package(Boost CONFIG REQUIRED COMPONENTS filesystem program_options) +find_package(Boost CONFIG REQUIRED COMPONENTS program_options) function(add_util name src) add_executable("${name}" ${src}) target_link_libraries("${name}" PRIVATE winapi_debug) - target_link_libraries("${name}" PRIVATE Boost::disable_autolinking Boost::filesystem Boost::program_options) + target_link_libraries("${name}" PRIVATE Boost::disable_autolinking Boost::program_options) install(TARGETS "${name}" RUNTIME DESTINATION bin) if(MSVC) install(FILES "$<TARGET_PDB_FILE:${name}>" DESTINATION bin OPTIONAL) diff --git a/utils/command_line.hpp b/utils/command_line.hpp index 7537d51..8f4b949 100644 --- a/utils/command_line.hpp +++ b/utils/command_line.hpp @@ -5,10 +5,10 @@ #pragma once -#include <boost/filesystem.hpp> #include <boost/program_options.hpp> #include <exception> +#include <filesystem> #include <iostream> #include <ostream> #include <string> @@ -54,7 +54,7 @@ protected: private: static std::string extract_filename(char* path) { - return boost::filesystem::path{path}.filename().string(); + return std::filesystem::path{path}.filename().string(); } const std::string prog_name; |
