diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-23 18:47:42 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-23 20:07:51 +0100 |
commit | 7a05bb5cfbf3560b828c226f4a3bad8c3826b039 (patch) | |
tree | ed77169173b89492869c787533f27d0bfb95480f /src/buildtool/execution_api/local/local_action.cpp | |
parent | 45cba2778426601bdffbcfe6aa7310aee76a6e54 (diff) | |
download | justbuild-7a05bb5cfbf3560b828c226f4a3bad8c3826b039.tar.gz |
Apply changes suggested by clang-tidy 11
Diffstat (limited to 'src/buildtool/execution_api/local/local_action.cpp')
-rw-r--r-- | src/buildtool/execution_api/local/local_action.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index 0c71a84b..d8ec8be3 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -184,21 +184,24 @@ auto LocalAction::CreateDirectoryStructure( } // create output paths - for (auto const& local_path : output_files_) { - if (not FileSystemManager::CreateDirectory( - (exec_path / local_path).parent_path())) { + auto const create_dir = [this](auto const& dir) { + if (not FileSystemManager::CreateDirectory(dir)) { logger_.Emit(LogLevel::Error, "failed to create output directory"); return false; } - } - for (auto const& local_path : output_dirs_) { - if (not FileSystemManager::CreateDirectory(exec_path / local_path)) { - logger_.Emit(LogLevel::Error, "failed to create output directory"); - return false; - } - } - - return true; + return true; + }; + return std::all_of(output_files_.begin(), + output_files_.end(), + [&exec_path, &create_dir](auto const& local_path) { + auto dir = (exec_path / local_path).parent_path(); + return create_dir(dir); + }) and + std::all_of(output_dirs_.begin(), + output_dirs_.end(), + [&exec_path, &create_dir](auto const& local_path) { + return create_dir(exec_path / local_path); + }); } auto LocalAction::CollectOutputFile(std::filesystem::path const& exec_path, |