aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/filesystem3
-rw-r--r--build2/filesystem.cxx14
2 files changed, 17 insertions, 0 deletions
diff --git a/build2/filesystem b/build2/filesystem
index 1b03c0e..325d28d 100644
--- a/build2/filesystem
+++ b/build2/filesystem
@@ -91,6 +91,9 @@ namespace build2
bool
exists (const dir_path&);
+
+ bool
+ empty (const dir_path&);
}
#include <build2/filesystem.txx>
diff --git a/build2/filesystem.cxx b/build2/filesystem.cxx
index c9696dc..be4cad8 100644
--- a/build2/filesystem.cxx
+++ b/build2/filesystem.cxx
@@ -124,4 +124,18 @@ namespace build2
throw failed ();
}
}
+
+ bool
+ empty (const dir_path& d)
+ {
+ try
+ {
+ return dir_empty (d);
+ }
+ catch (const system_error& e)
+ {
+ error << "unable to scan directory " << d << ": " << e.what ();
+ throw failed ();
+ }
+ }
}