summaryrefslogtreecommitdiffhomepage
path: root/file.cpp
blob: 823d72378bf282630f987057fd1445ebdb312cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "file.h"

#include <unordered_set>

namespace fs = std::filesystem;

const fs::path YMakefile{"YMakefile"};

// type of file can be built from dependencies
bool is_buildable_by_extension(const fs::path& p) {
 fs::path ext{p.extension()};
 return ext.empty() || ext == ".o";
}

namespace {
 std::unordered_set<fs::path> compile_unit_source_types{".cpp", ".c"};
}

// type of file is source of compile unit (no included types like headers)
bool is_compile_unit_source_by_extension(const fs::path& p) {
 fs::path ext{p.extension()};
 return compile_unit_source_types.find(ext) != compile_unit_source_types.end();
}