about summary refs log tree commit diff
path: root/src/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-08T13·22+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-08T13·22+0000
commit40274c1f4f763e634dd031f7a6b4ba8ce2de7a82 (patch)
tree87f701e59cbe12fc86a9e67aa04ac1321533400c /src/util.cc
parenta279137327ad5762bb26a23ce8ed7863812254ae (diff)
* A command to query the paths referenced by an fstate expression.
* Use a temporary directory for build actions.

Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc12
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;