aboutsummaryrefslogtreecommitdiff
path: root/butl/filesystem.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'butl/filesystem.cxx')
-rw-r--r--butl/filesystem.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/butl/filesystem.cxx b/butl/filesystem.cxx
index a47140d..424e361 100644
--- a/butl/filesystem.cxx
+++ b/butl/filesystem.cxx
@@ -66,6 +66,27 @@ namespace butl
}
#endif
+#ifndef _WIN32
+ bool
+ entry_exists (const char* p, bool fl)
+ {
+ struct stat s;
+ if ((fl ? stat (p, &s) : lstat (p, &s)) == 0)
+#else
+ bool
+ entry_exists (const char* p, bool)
+ {
+ struct _stat s;
+ if (_stat (p, &s) == 0)
+#endif
+ return true;
+
+ if (errno == ENOENT || errno == ENOTDIR)
+ return false;
+
+ throw system_error (errno, system_category ());
+ }
+
bool
dir_exists (const char* p)
{