From b741291c708e5c2088680a0d9d3c75efd98db421 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 1 Nov 2016 23:31:27 +0300 Subject: Make rmdir_r() to call entry_exists(path) rather than exists(dir_path) --- build2/filesystem.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'build2/filesystem.cxx') diff --git a/build2/filesystem.cxx b/build2/filesystem.cxx index be4cad8..c71d2da 100644 --- a/build2/filesystem.cxx +++ b/build2/filesystem.cxx @@ -79,7 +79,7 @@ namespace build2 if (work.sub (d)) // Don't try to remove working directory. return rmdir_status::not_empty; - if (!exists (d)) + if (!build2::entry_exists (d)) return rmdir_status::not_exist; if (verb >= v) @@ -126,6 +126,20 @@ namespace build2 } bool + entry_exists (const path& p, bool fs) + { + try + { + return butl::entry_exists (p, fs); + } + catch (const system_error& e) + { + error << "unable to stat path " << p << ": " << e.what (); + throw failed (); + } + } + + bool empty (const dir_path& d) { try -- cgit v1.1