aboutsummaryrefslogtreecommitdiff
path: root/butl
diff options
context:
space:
mode:
Diffstat (limited to 'butl')
-rw-r--r--butl/filesystem15
-rw-r--r--butl/filesystem.cxx18
2 files changed, 21 insertions, 12 deletions
diff --git a/butl/filesystem b/butl/filesystem
index 41b9266..4b4af6a 100644
--- a/butl/filesystem
+++ b/butl/filesystem
@@ -36,13 +36,19 @@ namespace butl
// this function resolves symlinks.
//
LIBBUTL_EXPORT bool
- file_exists (const path&);
+ file_exists (const char*);
+
+ inline bool
+ file_exists (const path& p) {return file_exists (p.string ().c_str ());}
// Return true if the path is to an existing directory. Note that
// this function resolves symlinks.
//
LIBBUTL_EXPORT bool
- dir_exists (const path&);
+ dir_exists (const char*);
+
+ inline bool
+ dir_exists (const path& p) {return dir_exists (p.string ().c_str ());}
// Return true if the directory is empty. Note that the path must exist
// and be a directory.
@@ -217,7 +223,10 @@ namespace butl
// symlinks.
//
LIBBUTL_EXPORT timestamp
- file_mtime (const path&);
+ file_mtime (const char*);
+
+ inline timestamp
+ file_mtime (const path& p) {return file_mtime (p.string ().c_str ());}
// Path permissions.
//
diff --git a/butl/filesystem.cxx b/butl/filesystem.cxx
index 9db8814..5584e00 100644
--- a/butl/filesystem.cxx
+++ b/butl/filesystem.cxx
@@ -35,14 +35,14 @@ using namespace std;
namespace butl
{
bool
- file_exists (const path& p)
+ file_exists (const char* p)
{
#ifndef _WIN32
struct stat s;
- if (stat (p.string ().c_str (), &s) != 0)
+ if (stat (p, &s) != 0)
#else
struct _stat s;
- if (_stat (p.string ().c_str (), &s) != 0)
+ if (_stat (p, &s) != 0)
#endif
{
if (errno == ENOENT || errno == ENOTDIR)
@@ -55,14 +55,14 @@ namespace butl
}
bool
- dir_exists (const path& p)
+ dir_exists (const char* p)
{
#ifndef _WIN32
struct stat s;
- if (stat (p.string ().c_str (), &s) != 0)
+ if (stat (p, &s) != 0)
#else
struct _stat s;
- if (_stat (p.string ().c_str (), &s) != 0)
+ if (_stat (p, &s) != 0)
#endif
{
if (errno == ENOENT || errno == ENOTDIR)
@@ -294,14 +294,14 @@ namespace butl
nsec (...) {return 0;}
timestamp
- file_mtime (const path& p)
+ file_mtime (const char* p)
{
#ifndef _WIN32
struct stat s;
- if (stat (p.string ().c_str (), &s) != 0)
+ if (stat (p, &s) != 0)
#else
struct _stat s;
- if (_stat (p.string ().c_str (), &s) != 0)
+ if (_stat (p, &s) != 0)
#endif
{
if (errno == ENOENT || errno == ENOTDIR)