diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-11 22:50:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-17 13:15:42 +0300 |
commit | 56e49a09b4f1d268bfee83324bbcd44eb925815b (patch) | |
tree | 9a8a8395560296fe52ad7b2fef487eef6ee7b4e6 /libbutl/filesystem.ixx | |
parent | aabd974df745b8f9c061ab162d9babfc9545c108 (diff) |
Add readsymlink(), followsymlink(), and try_followsymlink()
Diffstat (limited to 'libbutl/filesystem.ixx')
-rw-r--r-- | libbutl/filesystem.ixx | 11 |
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> |