diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-09-14 02:17:43 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-09-14 02:22:57 +0300 |
commit | d373bc6ed0c3b97526fc350b01d2d407409d0fce (patch) | |
tree | 980e72ed5aeabdea4e78fe434368ded664f14ea7 /test/unit_tests/paths.hpp | |
parent | unit_tests: add a test for call stack collection (diff) | |
download | winapi-debug-d373bc6ed0c3b97526fc350b01d2d407409d0fce.tar.gz winapi-debug-d373bc6ed0c3b97526fc350b01d2d407409d0fce.zip |
clang-format: regroup #includes
Diffstat (limited to 'test/unit_tests/paths.hpp')
-rw-r--r-- | test/unit_tests/paths.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/unit_tests/paths.hpp b/test/unit_tests/paths.hpp new file mode 100644 index 0000000..561ca4d --- /dev/null +++ b/test/unit_tests/paths.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include <boost/filesystem.hpp> +#include <boost/nowide/filesystem.hpp> +#include <boost/test/unit_test.hpp> + +using path = boost::filesystem::path; + +class FixFilesystem { +public: + FixFilesystem() { boost::nowide::nowide_filesystem(); } +}; + +class Paths { +public: + typedef boost::filesystem::path path; + + static Paths& get() { + static FixFilesystem fix_filesystem; + static Paths instance; + return instance; + } + + Paths() : exe_path{get_executable_path()}, exe_dir{exe_path.parent_path()} {} + + const path exe_path; + const path exe_dir; + +private: + static path get_executable_path() { + const auto argv0 = boost::unit_test::framework::master_test_suite().argv[0]; + return boost::filesystem::system_complete(argv0); + } + + Paths(const Paths&) = delete; + Paths& operator=(const Paths&) = delete; +}; |