aboutsummaryrefslogtreecommitdiff
path: root/libbutl/filesystem.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-12-12 13:25:19 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-12-12 14:23:40 +0300
commit82982e037dea53b334070699471e682fb023dc9e (patch)
tree67e7715a6f08f5468b441d66ad5c2d96729e9d11 /libbutl/filesystem.ixx
parentab64b769ca15d00257face17841c97d5405161a5 (diff)
Support detecting inaccessible/dangling entries in dir_iterator, path_search()
Diffstat (limited to 'libbutl/filesystem.ixx')
-rw-r--r--libbutl/filesystem.ixx12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbutl/filesystem.ixx b/libbutl/filesystem.ixx
index 763d311..193eae9 100644
--- a/libbutl/filesystem.ixx
+++ b/libbutl/filesystem.ixx
@@ -11,7 +11,7 @@ namespace butl
{
// @@ Could 0 size be a valid and faster way?
//
- return dir_iterator (d, false /* ignore_dangling */) == dir_iterator ();
+ return dir_iterator (d, dir_iterator::no_follow) == dir_iterator ();
}
inline bool
@@ -168,23 +168,23 @@ namespace butl
inline entry_type dir_entry::
ltype () const
{
- return t_ != entry_type::unknown ? t_ : (t_ = type (false));
+ return t_ ? *t_ : *(t_ = type (false /* follow_symlinks */));
}
inline entry_type dir_entry::
type () const
{
entry_type t (ltype ());
- return t != entry_type::symlink
- ? t
- : lt_ != entry_type::unknown ? lt_ : (lt_ = type (true));
+ return t != entry_type::symlink ? t :
+ lt_ ? *lt_ :
+ *(lt_ = type (true /* follow_symlinks */));
}
// dir_iterator
//
inline dir_iterator::
dir_iterator (dir_iterator&& x) noexcept
- : e_ (std::move (x.e_)), h_ (x.h_), ignore_dangling_ (x.ignore_dangling_)
+ : e_ (std::move (x.e_)), h_ (x.h_), mode_ (x.mode_)
{
#ifndef _WIN32
x.h_ = nullptr;