From 2d382487e63c742becdc1adb37b12818976926b8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 5 Aug 2021 11:59:09 +0200 Subject: Avoid normalizing likely already normalized directories in search_existing() --- libbuild2/algorithm.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index 54ddf78..52e0926 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -132,7 +132,14 @@ namespace build2 return nullptr; if (!n.dir.empty ()) - n.dir.normalize (false, true); // Current dir collapses to an empty one. + { + // More often than not a non-empty directory will already be normalized. + // + // Note that we collapse current dir to an empty one. + // + if (!n.dir.normalized () || n.dir.string () == ".") + n.dir.normalize (false, true); + } bool q (cn.qualified ()); -- cgit v1.1