Skip to content

Commit

Permalink
Silo: support filesystem in std::experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaas80 committed Jan 13, 2025
1 parent ad15372 commit 3a45c4a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CarpetX/src/io_silo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
#include <cstdlib>
#if defined __cpp_lib_filesystem && __cpp_lib_filesystem < 201703L
#include <experimental/filesystem>
using namespace std::experimental;
namespace filesystem = std::experimental::filesystem;
#else
#include <filesystem>
namespace filesystem = std::filesystem;
#endif
#include <fstream>
#include <iomanip>
Expand Down Expand Up @@ -196,12 +197,12 @@ int InputSiloParameters(const std::string &input_dir,
// Find latest iteration (if any)
try {
for (const auto &direntry :
std::filesystem::directory_iterator(input_dir)) {
filesystem::directory_iterator(input_dir)) {
const auto &filename = direntry.path().filename().string();
const int iter = match_filename(filename);
input_iteration = max(input_iteration, iter);
}
} catch (const std::filesystem::filesystem_error &) {
} catch (const filesystem::filesystem_error &) {
// do nothing if directory does not exist
}
}
Expand Down

0 comments on commit 3a45c4a

Please sign in to comment.