Fixed handling of relative paths on MSVC
This commit is contained in:
@@ -255,7 +255,7 @@ std::vector<std::string> diagram::get_translation_units() const
|
|||||||
|
|
||||||
std::filesystem::path diagram::root_directory() const
|
std::filesystem::path diagram::root_directory() const
|
||||||
{
|
{
|
||||||
return canonical(absolute(base_directory() / relative_to()));
|
return weakly_canonical(absolute(base_directory() / relative_to()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path diagram::make_path_relative(
|
std::filesystem::path diagram::make_path_relative(
|
||||||
|
|||||||
@@ -2311,13 +2311,10 @@ std::string translation_unit_visitor::make_lambda_name(
|
|||||||
const auto location = cls->getLocation();
|
const auto location = cls->getLocation();
|
||||||
const auto file_line = source_manager().getSpellingLineNumber(location);
|
const auto file_line = source_manager().getSpellingLineNumber(location);
|
||||||
const auto file_column = source_manager().getSpellingColumnNumber(location);
|
const auto file_column = source_manager().getSpellingColumnNumber(location);
|
||||||
const std::string file_name = config().make_path_relative(
|
const std::string file_name =
|
||||||
source_manager().getFilename(location).str());
|
config()
|
||||||
//
|
.make_path_relative(source_manager().getFilename(location).str())
|
||||||
// util::path_to_url(std::filesystem::relative(
|
.string();
|
||||||
// source_manager().getFilename(location).str(),
|
|
||||||
// config().relative_to())
|
|
||||||
// .string());
|
|
||||||
|
|
||||||
if (context().caller_id() != 0 &&
|
if (context().caller_id() != 0 &&
|
||||||
get_participant(context().caller_id()).has_value()) {
|
get_participant(context().caller_id()).has_value()) {
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ load_config(const std::string &test_name)
|
|||||||
|
|
||||||
const auto compilation_database_dir = canonical(
|
const auto compilation_database_dir = canonical(
|
||||||
std::filesystem::current_path() / std::filesystem::path{".."});
|
std::filesystem::current_path() / std::filesystem::path{".."});
|
||||||
const auto output_directory =
|
const auto output_directory = weakly_canonical(
|
||||||
std::filesystem::current_path() / std::filesystem::path{"diagrams"};
|
std::filesystem::current_path() / std::filesystem::path{"diagrams"});
|
||||||
|
|
||||||
res.first = clanguml::config::load(test_config_path, true, false, true);
|
res.first = clanguml::config::load(test_config_path, true, false, true);
|
||||||
|
|
||||||
|
|||||||
@@ -350,7 +350,11 @@ TEST_CASE("Test config relative paths handling", "[unit-test]")
|
|||||||
CHECK(cfg.diagrams.size() == 2);
|
CHECK(cfg.diagrams.size() == 2);
|
||||||
auto &def = *cfg.diagrams["class1"];
|
auto &def = *cfg.diagrams["class1"];
|
||||||
CHECK(def.get_relative_to()() == "/tmp");
|
CHECK(def.get_relative_to()() == "/tmp");
|
||||||
CHECK(def.root_directory() == "/tmp");
|
#ifdef _MSC_VER
|
||||||
|
CHECK(def.root_directory().string() == "C:\\tmp");
|
||||||
|
#else
|
||||||
|
CHECK(def.root_directory().string() == "/tmp");
|
||||||
|
#endif
|
||||||
|
|
||||||
def = *cfg.diagrams["class2"];
|
def = *cfg.diagrams["class2"];
|
||||||
CHECK(def.get_relative_to()() == ".");
|
CHECK(def.get_relative_to()() == ".");
|
||||||
|
|||||||
Reference in New Issue
Block a user