From 40274c1f4f763e634dd031f7a6b4ba8ce2de7a82 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jul 2003 13:22:08 +0000 Subject: * A command to query the paths referenced by an fstate expression. * Use a temporary directory for build actions. --- src/util.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/util.cc') 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; -- cgit 1.4.1