aboutsummaryrefslogtreecommitdiff
path: root/build/context
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-02 15:44:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-02 15:44:49 +0200
commit137df0bea6cebabe5278e67e5dad6f3047c762fb (patch)
tree2ea23a35f99d21a4d9eca89ed71ac9ba2a734f52 /build/context
parent65dca85d0acc1ae69518e85b52a2877e38dc8c6d (diff)
Handle "nothing to be done" case for disfigure
Diffstat (limited to 'build/context')
-rw-r--r--build/context23
1 files changed, 18 insertions, 5 deletions
diff --git a/build/context b/build/context
index 723f9f9..8ebce26 100644
--- a/build/context
+++ b/build/context
@@ -32,12 +32,25 @@ namespace build
void
reset ();
+ // The dual interface wrapper for the {mk,rm}{file,dir}() functions
+ // below that allows you to use it as a true/false return or a more
+ // detailed enum from <filesystem>
+ //
+ template <typename T>
+ struct fs_status
+ {
+ T v;
+ fs_status (T v): v (v) {};
+ operator T () const {return v;}
+ explicit operator bool () const {return v == T::success;}
+ };
+
// Create the directory and print the standard diagnostics. Note that
// this implementation is not suitable if it is expected that the
// directory will exist in the majority of case and performance is
// important. See the fsdir{} rule for details.
//
- mkdir_status
+ fs_status<mkdir_status>
mkdir (const path&);
// Remove the file and print the standard diagnostics. The second
@@ -46,19 +59,19 @@ namespace build
// being printed.
//
template <typename T>
- rmfile_status
+ fs_status<rmfile_status>
rmfile (const path&, const T& target);
- inline rmfile_status
+ inline fs_status<rmfile_status>
rmfile (const path& f) {return rmfile (f, f);}
// Similar to rmfile() but for directories.
//
template <typename T>
- rmdir_status
+ fs_status<rmdir_status>
rmdir (const path&, const T& target);
- inline rmdir_status
+ inline fs_status<rmdir_status>
rmdir (const path& d) {return rmdir (d, d);}
// Return the src/out directory corresponding to the given out/src. The