From 5b9e70290b3d25042fdca119ca5a058d8b37f458 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Apr 2024 08:00:21 +0200 Subject: Skip hidden filesystem entries when looking for subprojects --- libbuild2/dist/operation.cxx | 2 +- libbuild2/file.cxx | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libbuild2/dist/operation.cxx b/libbuild2/dist/operation.cxx index cd88eac..cfc90cf 100644 --- a/libbuild2/dist/operation.cxx +++ b/libbuild2/dist/operation.cxx @@ -156,7 +156,7 @@ namespace build2 { const path& n (e.path ()); - if (n.string ()[0] != '.') + if (!n.empty () && n.string ().front () != '.') try { if (e.type () == entry_type::directory) // Can throw. diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx index c0957ad..18147a2 100644 --- a/libbuild2/file.cxx +++ b/libbuild2/file.cxx @@ -859,6 +859,13 @@ namespace build2 for (const dir_entry& de: dir_iterator (d, dir_iterator::detect_dangling)) { + const path& n (de.path ()); + + // Skip hidden entries. + // + if (n.empty () || n.string ().front () == '.') + continue; + if (de.type () != entry_type::directory) { if (de.type () == entry_type::unknown) @@ -867,13 +874,13 @@ namespace build2 warn << "skipping " << (sl ? "dangling symlink" : "inaccessible entry") << ' ' - << d / de.path (); + << d / n; } continue; } - dir_path sd (d / path_cast (de.path ())); + dir_path sd (d / path_cast (n)); bool src (false); optional altn; -- cgit v1.1