aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/unit_tests/paths.hpp
blob: afc15ece7e377281236365988cfef32f25a8fd6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
// This file is part of the "PDB repository" project.
// For details, see https://github.com/egor-tensin/pdb-repo.
// Distributed under the MIT License.

#pragma once

#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>

using path = boost::filesystem::path;

class Paths {
public:
    typedef boost::filesystem::path path;

    static Paths& get() {
        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;
};