Fixed class and include diagrams tests in Windows

This commit is contained in:
Bartek Kryza
2023-01-12 23:31:12 +01:00
parent 3fbf3da27f
commit ada11c6047
11 changed files with 58 additions and 14 deletions

View File

@@ -47,7 +47,7 @@ public:
/// \brief Find element in diagram which can have full name or be
/// relative to ns
common::optional_ref<clanguml::common::model::diagram_element>
virtual common::optional_ref<clanguml::common::model::diagram_element>
get_with_namespace(const std::string &name, const namespace_ &ns) const;
diagram(const diagram &) = delete;

View File

@@ -374,6 +374,8 @@ paths_filter::paths_filter(filter_t type, const std::filesystem::path &root,
continue;
}
absolute_path.make_preferred();
paths_.emplace_back(std::move(absolute_path));
}
}
@@ -386,13 +388,15 @@ tvl::value_t paths_filter::match(
}
// Matching source paths doesn't make sens if they are not absolute
if (!p.is_absolute())
if (!p.is_absolute()) {
return {};
}
auto pp = p.fs_path(root_);
for (const auto &path : paths_) {
if (pp.root_name().string() == path.root_name().string() &&
util::starts_with(pp, path)) {
util::starts_with(pp.relative_path(), path.relative_path())) {
return true;
}
}

View File

@@ -56,10 +56,12 @@ public:
explicit source_file(const std::filesystem::path &p)
{
set_path({p.parent_path().string()});
set_name(p.filename().string());
is_absolute_ = p.is_absolute();
set_id(common::to_id(p));
auto preferred = p;
preferred.make_preferred();
set_path({preferred.parent_path().string()});
set_name(preferred.filename().string());
is_absolute_ = preferred.is_absolute();
set_id(common::to_id(preferred));
}
void set_path(const filesystem_path &p) { path_ = p; }
@@ -118,6 +120,17 @@ public:
return res.lexically_normal();
}
inja::json context() const override
{
inja::json ctx = diagram_element::context();
std::filesystem::path fullNamePath{ctx["full_name"].get<std::string>()};
fullNamePath.make_preferred();
ctx["full_name"] = fullNamePath.string();
return ctx;
}
private:
filesystem_path path_;
source_file_t type_{source_file_t::kDirectory};