diff --git a/include/bout/bout.hxx b/include/bout/bout.hxx index 8588fe56d9..a08696ec66 100644 --- a/include/bout/bout.hxx +++ b/include/bout/bout.hxx @@ -34,6 +34,8 @@ #ifndef BOUT_H #define BOUT_H +#include // std::filesystem (C++17) + // IWYU pragma: begin_keep, begin_export #include "bout/build_defines.hxx" @@ -106,10 +108,10 @@ void setupGetText(); struct CommandLineArgs { int verbosity{4}; bool color_output{false}; - std::string data_dir{"data"}; ///< Directory for data input/output - std::string opt_file{"BOUT.inp"}; ///< Filename for the options file - std::string set_file{"BOUT.settings"}; ///< Filename for the options file - std::string log_file{"BOUT.log"}; ///< File name for the log file + std::filesystem::path data_dir{"data"}; ///< Directory for data input/output + std::filesystem::path opt_file{"BOUT.inp"}; ///< Filename for the options file + std::filesystem::path set_file{"BOUT.settings"}; ///< Filename for the options file + std::filesystem::path log_file{"BOUT.log"}; ///< File name for the log file /// The original set of command line arguments std::vector original_argv; /// The "canonicalised" command line arguments, with single-letter diff --git a/src/bout++.cxx b/src/bout++.cxx index 7f23cf5f91..6de1c5713b 100644 --- a/src/bout++.cxx +++ b/src/bout++.cxx @@ -4,7 +4,7 @@ * Adapted from the BOUT code by B.Dudson, University of York, Oct 2007 * ************************************************************************** - * Copyright 2010-2023 BOUT++ contributors + * Copyright 2010-2025 BOUT++ contributors * * Contact Ben Dudson, dudson2@llnl.gov * @@ -84,7 +84,7 @@ const char DEFAULT_DIR[] = "data"; // Define S_ISDIR if not defined by system headers (that is, MSVC) // Taken from https://github.com/curl/curl/blob/e59540139a398dc70fde6aec487b19c5085105af/lib/curl_setup.h#L748-L751 #if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR) -#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #ifdef _MSC_VER @@ -180,7 +180,7 @@ int BoutInitialise(int& argc, char**& argv) { // `optionfile` here, but we'd need to call parseCommandLine // _first_ in order to do that and set the source, etc., but we // need to call that _second_ in order to override the input file - reader->read(Options::getRoot(), "{}/{}", args.data_dir, args.opt_file); + reader->read(Options::getRoot(), "{}", (args.data_dir / args.opt_file).string()); // Get options override from command-line reader->parseCommandLine(Options::getRoot(), args.argv);