aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-10-04 15:25:10 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-10-04 15:25:10 +0300
commitf2e26b666ab63c8c4ea1be0df4e64530147470b6 (patch)
tree67159a861f630acec1871594a6ee2169a69e4a83
parent182d743d15810d2a8393ed7fa5d565cf3a394694 (diff)
Add ignore_error parameter for functions that check file system entry existence
-rw-r--r--build2/cc/gcc.cxx5
-rw-r--r--build2/filesystem.cxx12
-rw-r--r--build2/filesystem.hxx10
3 files changed, 13 insertions, 14 deletions
diff --git a/build2/cc/gcc.cxx b/build2/cc/gcc.cxx
index 64c78ca..bcf2a89 100644
--- a/build2/cc/gcc.cxx
+++ b/build2/cc/gcc.cxx
@@ -109,10 +109,7 @@ namespace build2
{
dir_path d (s, 1, s.size () - 1);
- // @@ Pass true as the ignore_error argument for exists(), when
- // supported.
- //
- if (d.absolute () && exists (d) &&
+ if (d.absolute () && exists (d, true) &&
find (r.begin (), r.end (), d.normalize ()) == r.end ())
r.emplace_back (move (d));
}
diff --git a/build2/filesystem.cxx b/build2/filesystem.cxx
index eefaf99..58e3037 100644
--- a/build2/filesystem.cxx
+++ b/build2/filesystem.cxx
@@ -112,11 +112,11 @@ namespace build2
}
bool
- exists (const path& f, bool fs)
+ exists (const path& f, bool fs, bool ie)
{
try
{
- return file_exists (f, fs);
+ return file_exists (f, fs, ie);
}
catch (const system_error& e)
{
@@ -125,11 +125,11 @@ namespace build2
}
bool
- exists (const dir_path& d)
+ exists (const dir_path& d, bool ie)
{
try
{
- return dir_exists (d);
+ return dir_exists (d, ie);
}
catch (const system_error& e)
{
@@ -138,11 +138,11 @@ namespace build2
}
bool
- entry_exists (const path& p, bool fs)
+ entry_exists (const path& p, bool fs, bool ie)
{
try
{
- return butl::entry_exists (p, fs);
+ return butl::entry_exists (p, fs, ie);
}
catch (const system_error& e)
{
diff --git a/build2/filesystem.hxx b/build2/filesystem.hxx
index 8d1a7f0..fe4473c 100644
--- a/build2/filesystem.hxx
+++ b/build2/filesystem.hxx
@@ -95,16 +95,18 @@ namespace build2
rmdir_r (const dir_path&, bool dir = true, uint16_t verbosity = 1);
// Check for a file, directory or filesystem entry existence. Print the
- // diagnostics and fail on system error.
+ // diagnostics and fail on system error, unless ignore_error is true.
//
bool
- exists (const path&, bool follow_symlinks = true);
+ exists (const path&, bool follow_symlinks = true, bool ignore_error = false);
bool
- exists (const dir_path&);
+ exists (const dir_path&, bool ignore_error = false);
bool
- entry_exists (const path&, bool follow_symlinks = false);
+ entry_exists (const path&,
+ bool follow_symlinks = false,
+ bool ignore_error = false);
// Check for a directory emptiness. Print the diagnostics and fail on system
// error.