aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-08-05 11:59:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-08-05 11:59:09 +0200
commit2d382487e63c742becdc1adb37b12818976926b8 (patch)
tree1614e88ed92cd6345be5e72df30da840239884a6 /libbuild2/algorithm.cxx
parentea57c514dc169afb3ece21ff2e4c1d2ab0c47d6a (diff)
Avoid normalizing likely already normalized directories in search_existing()
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r--libbuild2/algorithm.cxx9
1 files changed, 8 insertions, 1 deletions
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 ());