diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-05-11 16:49:27 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-05-12 09:10:51 +0200 |
commit | a79c1c5b8718347047ffbed4979c696d7a10484a (patch) | |
tree | e732d83e5a47af0a8389125e86912fc04d1c5437 /src/utils/cpp | |
parent | b1b3f5bc981724a984ee4183ccb1fc456423411d (diff) | |
download | justbuild-a79c1c5b8718347047ffbed4979c696d7a10484a.tar.gz |
Ensure consistent path normalisation
In particular, ensure that the empty path and "." have the
same normal form.
Diffstat (limited to 'src/utils/cpp')
-rw-r--r-- | src/utils/cpp/path.hpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/cpp/path.hpp b/src/utils/cpp/path.hpp index 045ece0e..aa2c8350 100644 --- a/src/utils/cpp/path.hpp +++ b/src/utils/cpp/path.hpp @@ -7,7 +7,10 @@ -> std::filesystem::path { auto n = p.lexically_normal(); if (not n.has_filename()) { - return n.parent_path(); + n = n.parent_path(); + } + if (n.empty()) { + return std::filesystem::path{"."}; } return n; } |