diff options
Diffstat (limited to 'build/rule.cxx')
-rw-r--r-- | build/rule.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/build/rule.cxx b/build/rule.cxx index e57feca..41296f0 100644 --- a/build/rule.cxx +++ b/build/rule.cxx @@ -4,15 +4,13 @@ #include <build/rule> -#include <string.h> // strerror_r() -#include <sys/stat.h> // mkdir() -#include <sys/types.h> // mkdir() - -#include <utility> // move() +#include <utility> // move() +#include <system_error> #include <build/algorithm> #include <build/diagnostics> #include <build/timestamp> +#include <build/mkdir> using namespace std; @@ -169,13 +167,14 @@ namespace build else text << "mkdir " << t; //@@ Probably only show if [show]? - if (mkdir (d.string ().c_str (), 0777) != 0) + try + { + mkdir (d); + } + catch (const system_error& e) { - char b[512]; - const char* m (strerror_r (errno, b, sizeof (b)) == 0 - ? b - : "error message too long"); - fail << "mkdir: unable to create directory " << d.string () << ": " << m; + fail << "unable to create directory " << d.string () << ": " + << e.what (); } return target_state::updated; |