aboutsummaryrefslogtreecommitdiff
path: root/libbutl/filesystem.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-03-11 22:50:15 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-03-17 13:15:42 +0300
commit56e49a09b4f1d268bfee83324bbcd44eb925815b (patch)
tree9a8a8395560296fe52ad7b2fef487eef6ee7b4e6 /libbutl/filesystem.ixx
parentaabd974df745b8f9c061ab162d9babfc9545c108 (diff)
Add readsymlink(), followsymlink(), and try_followsymlink()
Diffstat (limited to 'libbutl/filesystem.ixx')
-rw-r--r--libbutl/filesystem.ixx11
1 files changed, 11 insertions, 0 deletions
diff --git a/libbutl/filesystem.ixx b/libbutl/filesystem.ixx
index a0ddc22..f7c3777 100644
--- a/libbutl/filesystem.ixx
+++ b/libbutl/filesystem.ixx
@@ -38,6 +38,17 @@ namespace butl
return e ? rmdir_status::success : rmdir_status::not_exist;
}
+ inline path
+ followsymlink (const path& p)
+ {
+ std::pair<path, bool> r (try_followsymlink (p));
+
+ if (!r.second)
+ throw_generic_error (ENOENT);
+
+ return std::move (r.first);
+ }
+
// auto_rm
//
template <typename P>