Skip to content

Commit

Permalink
Append a Trailing / to Prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Sep 5, 2024
1 parent 59bb1cd commit 61b7b1e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Src/Base/AMReX_ParmParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,14 @@ read_file (const char* fname, ParmParse::Table& tab)
std::string filename = fname;

// optional prefix to search files in
char const *amrex_inputs_file_prefix = std::getenv("AMREX_INPUTS_FILE_PREFIX");
if (amrex_inputs_file_prefix != nullptr) {
filename = std::string(amrex_inputs_file_prefix) + filename;
char const *amrex_inputs_file_prefix_c = std::getenv("AMREX_INPUTS_FILE_PREFIX");
if (amrex_inputs_file_prefix_c != nullptr) {
// we expect a directory path as the prefix: append a trailing "/" if missing
auto amrex_inputs_file_prefix = std::string(amrex_inputs_file_prefix_c);
if (amrex_inputs_file_prefix.back() != "/") {
amrex_inputs_file_prefix += "/";
}
filename = amrex_inputs_file_prefix + filename;
}

#ifdef AMREX_USE_MPI
Expand Down

0 comments on commit 61b7b1e

Please sign in to comment.