aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-12-08 21:13:47 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-12-12 18:28:02 +0300
commitab7dba520c8efd2cfbdd71dd91ae6b60923a12cd (patch)
treebb4cf6a252397c5aa1f0cf9ef7a3ab064b6079e6 /libbuild2/file.cxx
parentaeae50fe987b1787d1c1ae6f5c0bfb4f179205ef (diff)
Adapt to dir_iterator API change
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index 03dea5f..bf50a25 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -358,7 +358,7 @@ namespace build2
//
try
{
- for (const dir_entry& de: dir_iterator (d, false /* ignore_dangling */))
+ for (const dir_entry& de: dir_iterator (d, dir_iterator::no_follow))
{
// If this is a link, then type() will try to stat() it. And if the
// link is dangling or points to something inaccessible, it will fail.
@@ -847,10 +847,26 @@ namespace build2
try
{
- for (const dir_entry& de: dir_iterator (d, true /* ignore_dangling */))
+ // It's probably possible that a subproject can be a symlink with the
+ // link target, for example, being in a git submodule. Considering that,
+ // it makes sense to warn about dangling symlinks.
+ //
+ for (const dir_entry& de:
+ dir_iterator (d, dir_iterator::detect_dangling))
{
if (de.type () != entry_type::directory)
+ {
+ if (de.type () == entry_type::unknown)
+ {
+ bool sl (de.ltype () == entry_type::symlink);
+
+ warn << "skipping "
+ << (sl ? "dangling symlink" : "inaccessible entry") << ' '
+ << d / de.path ();
+ }
+
continue;
+ }
dir_path sd (d / path_cast<dir_path> (de.path ()));