From cc8a2a1517cc3c55bdeb066a038868fb8c7f04d6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 1 Nov 2016 22:58:25 +0300 Subject: Add entry_exists(path) --- butl/filesystem | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'butl/filesystem') diff --git a/butl/filesystem b/butl/filesystem index e6aaa20..3de1fcb 100644 --- a/butl/filesystem +++ b/butl/filesystem @@ -51,6 +51,16 @@ namespace butl inline bool dir_exists (const path& p) {return dir_exists (p.string ().c_str ());} + // Return true if the path is to an existing file system entry. Note that by + // default this function doesn't follow symlinks. + // + LIBBUTL_EXPORT bool + entry_exists (const char*, bool follow_symlinks = false); + + inline bool + entry_exists (const path& p, bool fs = false) { + return entry_exists (p.string ().c_str (), fs);} + // Return true if the directory is empty. Note that the path must exist // and be a directory. // -- cgit v1.1