@@ -944,7 +944,10 @@ namespace aspect
944944 " text `$ASPECT_SOURCE_DIR' which will be interpreted as the path "
945945 " in which the ASPECT source files were located when ASPECT was "
946946 " compiled. This interpretation allows, for example, to reference "
947- " files located in the `data/' subdirectory of ASPECT." );
947+ " files located in the `data/' subdirectory of ASPECT. A trailing "
948+ " slash at the end of the directory path is optional; the plugin "
949+ " will automatically append a '/' when the parameters are parsed if "
950+ " it is missing." );
948951 prm.declare_entry (" Data file name" ,
949952 default_filename,
950953 Patterns::Anything (),
@@ -972,6 +975,9 @@ namespace aspect
972975 // to $ASPECT_SOURCE_DIR, replace it by what CMake has given us
973976 // as a #define
974977 data_directory = Utilities::expand_ASPECT_SOURCE_DIR (prm.get (" Data directory" ));
978+ // ensure directory ends with a slash so callers can safely do data_directory + filename
979+ if (!data_directory.empty () && data_directory.back () != ' /' )
980+ data_directory.push_back (' /' );
975981 data_file_name = prm.get (" Data file name" );
976982 scale_factor = prm.get_double (" Scale factor" );
977983 }
@@ -1680,7 +1686,10 @@ namespace aspect
16801686 " text `$ASPECT_SOURCE_DIR' which will be interpreted as the path "
16811687 " in which the ASPECT source files were located when ASPECT was "
16821688 " compiled. This interpretation allows, for example, to reference "
1683- " files located in the `data/' subdirectory of ASPECT. " );
1689+ " files located in the `data/' subdirectory of ASPECT. A trailing "
1690+ " slash at the end of the directory path is optional; the plugin "
1691+ " will automatically append a '/' when the parameters are parsed if "
1692+ " it is missing. " );
16841693
16851694 prm.declare_entry (" Data file names" ,
16861695 default_filename,
@@ -1711,6 +1720,9 @@ namespace aspect
17111720 prm.enter_subsection (subsection_name);
17121721 {
17131722 data_directory = Utilities::expand_ASPECT_SOURCE_DIR (prm.get (" Data directory" ));
1723+ // ensure directory ends with a slash so callers can safely do data_directory + filename
1724+ if (!data_directory.empty () && data_directory.back () != ' /' )
1725+ data_directory.push_back (' /' );
17141726 data_file_names = Utilities::split_string_list (prm.get (" Data file names" ), ' ,' );
17151727 interpolation_scheme = prm.get (" Interpolation scheme" );
17161728 }
0 commit comments