From 8a94444897d24b135c92a73832ccc0147416943b Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Thu, 23 Apr 2020 17:23:39 +0200 Subject: [PATCH] [BL] Refactored removeFiles(). --- BaseLib/FileTools.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp index 6f32612f463..f8f541a048b 100644 --- a/BaseLib/FileTools.cpp +++ b/BaseLib/FileTools.cpp @@ -119,21 +119,11 @@ void removeFiles(std::vector<std::string> const& files) { for (auto const& file : files) { - int const success = std::remove(file.c_str()); - if (success == 0) + bool const success = fs::remove(fs::path(file)); + if (success) { DBUG("Removed '{:s}'", file); } - else - { - if (errno == ENOENT) // File does not exists - { - continue; - } - ERR("Removing file '{:s}' failed with error {:d}.", file, errno); - std::perror("Error: "); - OGS_FATAL("Unrecoverable error happened while removing a file."); - } } } } // end namespace BaseLib -- GitLab