Skip to content
Snippets Groups Projects
Verified Commit e18ecc3f authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

ModFile::remove_directory_with_matlab_lock(): minor performance improvement

Use std::filesystem::file_status and cached directory entries information to
avoid extra filesystem operations.
parent bae04fa8
No related branches found
No related tags found
No related merge requests found
Pipeline #7982 passed
...@@ -761,12 +761,13 @@ ModFile::computingPass(bool no_tmp_terms, OutputType output, int params_derivs_o ...@@ -761,12 +761,13 @@ ModFile::computingPass(bool no_tmp_terms, OutputType output, int params_derivs_o
void void
ModFile::remove_directory_with_matlab_lock(const filesystem::path &dir) ModFile::remove_directory_with_matlab_lock(const filesystem::path &dir)
{ {
if (!exists(dir)) auto dirStatus {status(dir)};
if (!exists(dirStatus))
return; return;
if (is_directory(dir)) if (is_directory(dirStatus))
for (const auto &e : filesystem::directory_iterator{dir}) for (const auto &e : filesystem::directory_iterator{dir})
if (is_directory(e)) if (e.is_directory())
remove_directory_with_matlab_lock(e); remove_directory_with_matlab_lock(e);
auto tmp {unique_path()}; auto tmp {unique_path()};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment