From 86576cdd3c8d959ffe93f49b7744a99164f172ee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Jul 2016 16:13:58 +0200 Subject: Move filesystem-related functions from context to new filesystem files --- build2/context | 71 ---------------------------------------------------------- 1 file changed, 71 deletions(-) (limited to 'build2/context') diff --git a/build2/context b/build2/context index 3f47af6..dc7d0c0 100644 --- a/build2/context +++ b/build2/context @@ -5,10 +5,6 @@ #ifndef BUILD2_CONTEXT #define BUILD2_CONTEXT -#include // enable_if - -#include - #include #include @@ -62,73 +58,6 @@ namespace build2 variable_overrides reset (const strings& cmd_vars); - // 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 starting from - // the specified verbosity level. - // - // Note that this implementation is not suitable if it is expected that the - // directory will exist in the majority of cases and performance is - // important. See the fsdir{} rule for details. - // - using mkdir_status = butl::mkdir_status; - - fs_status - mkdir (const dir_path&, uint16_t verbosity = 1); - - fs_status - mkdir_p (const dir_path&, uint16_t verbosity = 1); - - // Remove the file and print the standard diagnostics starting from the - // specified verbosity level. The second argument is only used in - // diagnostics, to print the target name. Passing the path for target will - // result in the relative path being printed. - // - using rmfile_status = butl::rmfile_status; - - template - fs_status - rmfile (const path&, const T& target, uint16_t verbosity = 1); - - inline fs_status - rmfile (const path& f, int verbosity = 1) // Literal overload (int). - { - return rmfile (f, f, static_cast (verbosity)); - } - - // Similar to rmfile() but for directories (note: not -r). - // - using rmdir_status = butl::rmdir_status; - - template - fs_status - rmdir (const dir_path&, const T& target, uint16_t verbosity = 1); - - inline fs_status - rmdir (const dir_path& d, int verbosity = 1) // Literal overload (int). - { - return rmdir (d, d, static_cast (verbosity)); - } - - // Remove the directory recursively and print the standard diagnostics - // starting from the specified verbosity level. Note that this function - // returns not_empty if we try to remove a working directory. If the dir - // argument is false, then the directory itself is not removed. - // - fs_status - rmdir_r (const dir_path&, bool dir = true, uint16_t verbosity = 1); - // Return the src/out directory corresponding to the given out/src. The // passed directory should be a sub-directory of out/src_root. // -- cgit v1.1