diff options
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index 2f9c43e55ce5..8ccd3c1524d8 100644 --- a/src/util.cc +++ b/src/util.cc @@ -66,6 +66,18 @@ string baseNameOf(string path) } +bool pathExists(const string & path) +{ + int res; + struct stat st; + res = stat(path.c_str(), &st); + if (!res) return true; + if (errno != ENOENT) + throw SysError(format("getting status of %1%") % path); + return false; +} + + void deletePath(string path) { struct stat st; |