From 137df0bea6cebabe5278e67e5dad6f3047c762fb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 2 Apr 2015 15:44:49 +0200 Subject: Handle "nothing to be done" case for disfigure --- build/context | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'build/context') 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 + // + template + 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 (const path&); // Remove the file and print the standard diagnostics. The second @@ -46,19 +59,19 @@ namespace build // being printed. // template - rmfile_status + fs_status rmfile (const path&, const T& target); - inline rmfile_status + inline fs_status rmfile (const path& f) {return rmfile (f, f);} // Similar to rmfile() but for directories. // template - rmdir_status + fs_status rmdir (const path&, const T& target); - inline rmdir_status + inline fs_status rmdir (const path& d) {return rmdir (d, d);} // Return the src/out directory corresponding to the given out/src. The -- cgit v1.1