From cf6b3e34b59ad120111e0c1ead779bbb3a70c38d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 12 Mar 2015 15:43:17 +0200 Subject: Implement clean operation --- build/filesystem | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 build/filesystem (limited to 'build/filesystem') diff --git a/build/filesystem b/build/filesystem new file mode 100644 index 0000000..8fa76c2 --- /dev/null +++ b/build/filesystem @@ -0,0 +1,40 @@ +// file : build/filesystem -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef BUILD_FILESYSTEM +#define BUILD_FILESYSTEM + +#include // mode_t + +#include + +namespace build +{ + // Note that you should probably use the default mode 0777 and let + // the umask mechanism adjust it to the user's preferences. Errors + // are reported by throwing std::system_error. + // + void + mkdir (const path&, mode_t = 0777); + + // Try to remove the directory returning not_exist if it does not + // exist and not_empty if it is not empty. All other errors are + // reported by throwing std::system_error. + // + enum class rmdir_status {success, not_exist, not_empty}; + + rmdir_status + try_rmdir (const path&); + + // Try to remove the file (or symbolic link) returning not_exist if + // it does not exist. All other errors are reported by throwing + // std::system_error. + // + enum class rmfile_status {success, not_exist}; + + rmfile_status + try_rmfile (const path&); +} + +#endif // BUILD_FILESYSTEM -- cgit v1.1