From a79c1c5b8718347047ffbed4979c696d7a10484a Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 11 May 2022 16:49:27 +0200 Subject: Ensure consistent path normalisation In particular, ensure that the empty path and "." have the same normal form. --- src/utils/cpp/path.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/utils/cpp/path.hpp') 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; } -- cgit v1.2.3