Fix locating h5m files references in DAGMC universes (#2842)

This commit is contained in:
Paul Romano 2024-01-16 11:12:44 -06:00 committed by GitHub
parent 5549b58e1f
commit d7d2230e5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 15 deletions

View file

@ -304,8 +304,9 @@ int parse_command_line(int argc, char* argv[])
settings::path_input));
}
// Add slash at end of directory if it isn't the
if (!ends_with(settings::path_input, "/")) {
// Add slash at end of directory if it isn't there
if (!ends_with(settings::path_input, "/") &&
dir_exists(settings::path_input)) {
settings::path_input += "/";
}
}
@ -315,18 +316,11 @@ int parse_command_line(int argc, char* argv[])
bool read_model_xml()
{
std::string model_filename =
settings::path_input.empty() ? "." : settings::path_input;
// some string cleanup
// a trailing "/" is applied to path_input if it's specified,
// remove it for the first attempt at reading the input file
if (ends_with(model_filename, "/"))
model_filename.pop_back();
std::string model_filename = settings::path_input;
// if the current filename is a directory, append the default model filename
if (dir_exists(model_filename))
model_filename += "/model.xml";
if (model_filename.empty() || dir_exists(model_filename))
model_filename += "model.xml";
// if this file doesn't exist, stop here
if (!file_exists(model_filename))