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.cxx | 86 ------------------------------------------------------ 1 file changed, 86 deletions(-) (limited to 'build2/context.cxx') diff --git a/build2/context.cxx b/build2/context.cxx index 5530ce3..60e55bd 100644 --- a/build2/context.cxx +++ b/build2/context.cxx @@ -325,92 +325,6 @@ namespace build2 return vos; } - fs_status - mkdir (const dir_path& d, uint16_t v) - { - // We don't want to print the command if the directory already exists. - // This makes the below code a bit ugly. - // - mkdir_status ms; - - try - { - ms = try_mkdir (d); - } - catch (const system_error& e) - { - if (verb >= v) - text << "mkdir " << d; - - error << "unable to create directory " << d << ": " << e.what (); - throw failed (); - } - - if (ms == mkdir_status::success) - { - if (verb >= v) - text << "mkdir " << d; - } - - return ms; - } - - fs_status - mkdir_p (const dir_path& d, uint16_t v) - { - // We don't want to print the command if the directory already exists. - // This makes the below code a bit ugly. - // - mkdir_status ms; - - try - { - ms = try_mkdir_p (d); - } - catch (const system_error& e) - { - if (verb >= v) - text << "mkdir -p " << d; - - error << "unable to create directory " << d << ": " << e.what (); - throw failed (); - } - - if (ms == mkdir_status::success) - { - if (verb >= v) - text << "mkdir -p " << d; - } - - return ms; - } - - fs_status - rmdir_r (const dir_path& d, bool dir, uint16_t v) - { - using namespace butl; - - if (work.sub (d)) // Don't try to remove working directory. - return rmdir_status::not_empty; - - if (!dir_exists (d)) - return rmdir_status::not_exist; - - if (verb >= v) - text << "rmdir -r " << d; - - try - { - butl::rmdir_r (d, dir); - } - catch (const system_error& e) - { - fail << "unable to remove directory " << d << ": " << e.what (); - } - - return rmdir_status::success; - } - dir_path src_out (const dir_path& out, scope& r) { -- cgit v1.1