#include "file.h" #include 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 compile_unit_source_types{".cpp", ".c", ".cc", ".S", ".rs"}; } // 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(); } std::filesystem::path simplified_path(const std::filesystem::path& p) { if (p.string().substr(0, 2) == "./") { return p.string().substr(2); } return p; }