Skip to content

Commit 875bf16

Browse files
authored
Merge pull request #233 from bkryza/fix-glob-absolute-paths
Fixed handling of absolute paths in glob patterns
2 parents 334140b + 7d28be5 commit 875bf16

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
param ($Prefix="C:\clang-uml", $BuildType="Release")
1+
param ($Prefix="C:\clang-uml-llvm17", $BuildType="Release")
22

33
cmake -S . -B $BuildType -DCMAKE_PREFIX_PATH="$Prefix" -DENABLE_CXX_MODULES_TEST_CASES=OFF -Thost=x64
44
cmake --build $BuildType --config $BuildType

packaging/make_installer.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This script assumes that all clang-uml dependencies are instaled in C:\clang-uml
22

3-
param ($Prefix="C:\clang-uml", $BuildType="Release")
3+
param ($Prefix="C:\clang-uml-llvm17", $BuildType="Release")
44

55
mkdir _BUILD
66

src/config/config.cc

+10-4
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,18 @@ std::vector<std::string> diagram::get_translation_units() const
253253
LOG_DBG("Looking for translation units in {}", root_directory().string());
254254

255255
for (const auto &g : glob()) {
256-
std::string glob_path =
257-
fmt::format("{}/{}", root_directory().string(), g.c_str());
256+
std::filesystem::path absolute_glob_path{g};
258257

259-
LOG_DBG("Searching glob path {}", glob_path);
258+
#ifdef _MSC_VER
259+
if (!absolute_glob_path.has_root_name())
260+
#else
261+
if (!absolute_glob_path.is_absolute())
262+
#endif
263+
absolute_glob_path = root_directory() / absolute_glob_path;
264+
265+
LOG_DBG("Searching glob path {}", absolute_glob_path.string());
260266

261-
auto matches = glob::glob(glob_path, true, false);
267+
auto matches = glob::glob(absolute_glob_path.string(), true, false);
262268

263269
for (const auto &match : matches) {
264270
const auto path =

tests/t00025/.clang-uml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diagrams:
22
t00025_class:
33
type: class
44
glob:
5-
- /t00025.cc
5+
- t00025.cc
66
using_namespace: clanguml::t00025
77
include:
88
namespaces:

0 commit comments

Comments
 (0)