diff --git a/src/Bytecode.cc b/src/Bytecode.cc
index ffbbf217bc839cc79b94a54cbe44e7757b26e6bc..09cc6c839ca5b6500b1ece4f19f7aa527546e503 100644
--- a/src/Bytecode.cc
+++ b/src/Bytecode.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2022 Dynare Team
+ * Copyright © 2022-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -23,12 +23,12 @@
 
 #include "Bytecode.hh"
 
-BytecodeWriter::BytecodeWriter(const string &filename)
+BytecodeWriter::BytecodeWriter(const filesystem::path &filename)
 {
   open(filename, ios::out | ios::binary);
   if (!is_open())
     {
-      cerr << R"(Error : Can't open file ")" << filename << R"(" for writing)" << endl;
+      cerr << R"(Error : Can't open file ")" << filename.string() << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
 }
diff --git a/src/Bytecode.hh b/src/Bytecode.hh
index f01dded8cb1955c0f397261a7b8b858c7d256450..c0bd121374fc08e2d2df1dd0716c0f43162420ae 100644
--- a/src/Bytecode.hh
+++ b/src/Bytecode.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2007-2022 Dynare Team
+ * Copyright © 2007-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -24,6 +24,7 @@
 #include <vector>
 #include <utility>
 #include <ios>
+#include <filesystem>
 
 #include "CommonEnums.hh"
 
@@ -1111,7 +1112,7 @@ private:
   // Stores the positions of all instructions in the byte stream
   vector<pos_type> instructions_positions;
 public:
-  BytecodeWriter(const string &filename);
+  BytecodeWriter(const filesystem::path &filename);
   // Returns the number of the next instruction to be written
   int
   getInstructionCounter() const
diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index aff8477245df80d9344e34a010ab8979dc1c867a..f97251802d4c02e6620de3a839b249c8adb008eb 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -5357,11 +5357,11 @@ OccbinConstraintsStatement::writeOutput(ostream &output, const string &basename,
          << "options_.occbin = occbin.set_default_options(options_.occbin, M_);" << endl
          << "oo_.dr=set_state_space(oo_.dr,M_,options_);" <<  endl;
 
-  string filename = "+" + basename + "/occbin_difference.m";
+  filesystem::path filename {"+" + basename + "/occbin_difference.m"};
   ofstream diff_output{filename, ios::out | ios::binary};
   if (!diff_output.is_open())
     {
-      cerr << "Error: Can't open file " << filename << " for writing" << endl;
+      cerr << "Error: Can't open file " << filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
   diff_output << "function [binding, relax, err] = occbin_difference(zdatalinear, params, steady_state)" << endl;
diff --git a/src/ConfigFile.cc b/src/ConfigFile.cc
index 7b5fb607d24b2aa9815e6f27f9c79618183c2474..198aa958f1e7fa4ebae39415cd530fa67b97f5e7 100644
--- a/src/ConfigFile.cc
+++ b/src/ConfigFile.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2022 Dynare Team
+ * Copyright © 2010-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -21,7 +21,6 @@
 #include <fstream>
 #include <utility>
 #include <vector>
-#include <filesystem>
 
 #include "ConfigFile.hh"
 
@@ -108,17 +107,20 @@ ConfigFile::ConfigFile(bool parallel_arg, bool parallel_test_arg,
 }
 
 void
-ConfigFile::getConfigFileInfo(const string &config_file)
+ConfigFile::getConfigFileInfo(const filesystem::path &config_file)
 {
   using namespace boost;
   ifstream configFile;
 
   if (config_file.empty())
     {
-      string defaultConfigFile;
+      filesystem::path defaultConfigFile;
       // Test OS and try to open default file
 #if defined(_WIN32) || defined(__CYGWIN32__)
-      if (getenv("APPDATA") == nullptr)
+      if (auto appdata = getenv("APPDATA");
+          appdata)
+        defaultConfigFile = filesystem::path{appdata} / "dynare.ini";
+      else
         {
           if (parallel || parallel_test)
             cerr << "ERROR: ";
@@ -129,13 +131,11 @@ ConfigFile::getConfigFileInfo(const string &config_file)
           if (parallel || parallel_test)
             exit(EXIT_FAILURE);
         }
-      else
-        {
-          defaultConfigFile += getenv("APPDATA");
-          defaultConfigFile += "\\dynare.ini";
-        }
 #else
-      if (getenv("HOME") == nullptr)
+      if (auto home = getenv("HOME");
+          home)
+        defaultConfigFile = filesystem::path{home} / ".dynare";
+      else
         {
           if (parallel || parallel_test)
             cerr << "ERROR: ";
@@ -145,17 +145,12 @@ ConfigFile::getConfigFileInfo(const string &config_file)
           if (parallel || parallel_test)
             exit(EXIT_FAILURE);
         }
-      else
-        {
-          defaultConfigFile += getenv("HOME");
-          defaultConfigFile += "/.dynare";
-        }
 #endif
       configFile.open(defaultConfigFile, fstream::in);
       if (!configFile.is_open())
         if (parallel || parallel_test)
           {
-            cerr << "ERROR: Could not open the default config file (" << defaultConfigFile << ")" << endl;
+            cerr << "ERROR: Could not open the default config file (" << defaultConfigFile.string() << ")" << endl;
             exit(EXIT_FAILURE);
           }
         else
@@ -166,7 +161,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
       configFile.open(config_file, fstream::in);
       if (!configFile.is_open())
         {
-          cerr << "ERROR: Couldn't open file " << config_file << endl;;
+          cerr << "ERROR: Couldn't open file " << config_file.string() << endl;;
           exit(EXIT_FAILURE);
         }
     }
diff --git a/src/ConfigFile.hh b/src/ConfigFile.hh
index 1a90d36fe3bed1dc663ef1a3468986a7abd27a81..75eae7530d9a693d26006a7d0bc2b72f50bfb7bf 100644
--- a/src/ConfigFile.hh
+++ b/src/ConfigFile.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2022 Dynare Team
+ * Copyright © 2010-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -22,6 +22,7 @@
 
 #include <map>
 #include <vector>
+#include <filesystem>
 
 #include "WarningConsolidation.hh"
 
@@ -119,7 +120,7 @@ private:
                                   const string &operatingSystem);
 public:
   //! Parse config file
-  void getConfigFileInfo(const string &parallel_config_file);
+  void getConfigFileInfo(const filesystem::path &parallel_config_file);
   //! Check Pass
   void checkPass(WarningConsolidation &warnings) const;
   //! Check Pass
diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index e0d9e051c84fd5aff93630d74c0be00c75477436..235b712ed1452e45d5db8406b4c3e42ecaf970fa 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -621,11 +621,11 @@ DynamicModel::writeDynamicBlockBytecode(const string &basename) const
 {
   BytecodeWriter code_file {basename + "/model/bytecode/dynamic.cod"};
 
-  const string bin_filename {basename + "/model/bytecode/dynamic.bin"};
+  const filesystem::path bin_filename {basename + "/model/bytecode/dynamic.bin"};
   ofstream bin_file {bin_filename, ios::out | ios::binary};
   if (!bin_file.is_open())
     {
-      cerr << R"(Error : Can't open file ")" << bin_filename << R"(" for writing)" << endl;
+      cerr << R"(Error : Can't open file ")" << bin_filename.string() << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
 
@@ -792,12 +792,12 @@ DynamicModel::writeDynamicBlockMFile(const string &basename) const
 void
 DynamicModel::writeDynamicBlockCFile(const string &basename, vector<filesystem::path> per_block_object_files, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot) const
 {
-  string filename = basename + "/model/src/dynamic.c";
+  const filesystem::path filename {basename + "/model/src/dynamic.c"};
 
   ofstream output{filename, ios::out | ios::binary};
   if (!output.is_open())
     {
-      cerr << "Error: Can't open file " << filename << " for writing" << endl;
+      cerr << "Error: Can't open file " << filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
 
@@ -1063,7 +1063,8 @@ DynamicModel::writeDynamicJacobianNonZeroEltsFile(const string &basename) const
   sort(nzij_current.begin(), nzij_current.end());
   sort(nzij_fwrd.begin(), nzij_fwrd.end());
 
-  ofstream output{packageDir(basename) / "dynamic_g1_nz.m", ios::out | ios::binary};
+  const filesystem::path filename {packageDir(basename) / "dynamic_g1_nz.m"};
+  ofstream output{filename, ios::out | ios::binary};
   output << "function [nzij_pred, nzij_current, nzij_fwrd] = dynamic_g1_nz()" << endl
          << "% Returns the coordinates of non-zero elements in the Jacobian, in column-major order, for each lead/lag (only for endogenous)" << endl;
   auto print_nzij = [&output](const vector<pair<int, int>> &nzij, const string &name) {
@@ -1497,7 +1498,7 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
   if (estimation_present)
     {
       filesystem::create_directories(basename + "/model/bytecode");
-      string main_name = basename + "/model/bytecode/kfi";
+      const filesystem::path main_name {basename + "/model/bytecode/kfi"};
       ofstream KF_index_file{main_name, ios::out | ios::binary | ios::ate};
       int n_obs = symbol_table.observedVariablesNbr();
       int n_state = state_var.size();
diff --git a/src/DynareMain.cc b/src/DynareMain.cc
index 4acd1bd2359929e991029a2ff383aff1402641ce..e4bd0efdea658cc820417399b70c89f6c782f568 100644
--- a/src/DynareMain.cc
+++ b/src/DynareMain.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -25,6 +25,7 @@
 #include <regex>
 #include <thread>
 #include <algorithm>
+#include <filesystem>
 
 #include <cstdlib>
 
@@ -42,8 +43,8 @@
    Function can be found in: MacroExpandModFile.cc
 */
 stringstream
-macroExpandModFile(const string &filename, const string &basename, const istream &modfile,
-                   bool debug, bool save_macro, string save_macro_file, bool line_macro,
+macroExpandModFile(const filesystem::path &filename, const istream &modfile,
+                   bool debug, bool save_macro, filesystem::path save_macro_file, bool line_macro,
                    const vector<pair<string, string>> &defines,
                    vector<filesystem::path> paths);
 
@@ -107,11 +108,11 @@ main(int argc, char **argv)
       usage();
     }
 
-  string filename = argv[1];
+  const filesystem::path filename {argv[1]};
   ifstream modfile(filename, ios::binary);
   if (modfile.fail())
     {
-      cerr << "ERROR: Could not open file: " << argv[1] << endl;
+      cerr << "ERROR: Could not open file: " << filename.string() << endl;
       exit(EXIT_FAILURE);
     }
 
@@ -125,7 +126,7 @@ main(int argc, char **argv)
   bool clear_all = true;
   bool clear_global = false;
   bool save_macro = false;
-  string save_macro_file;
+  filesystem::path save_macro_file;
   bool debug = false;
   bool no_tmp_terms = false;
   bool only_macro = false;
@@ -136,7 +137,7 @@ main(int argc, char **argv)
   bool console = false;
   bool nograph = false;
   bool nointeractive = false;
-  string parallel_config_file;
+  filesystem::path parallel_config_file;
   bool parallel = false;
   string cluster_name;
   bool parallel_follower_open_mode = false; // Must be the same default as in matlab/default_option_values.m
@@ -438,10 +439,10 @@ main(int argc, char **argv)
     dynareroot = dynareroot.parent_path();
 
   // Construct basename (i.e. remove file extension if there is one)
-  string basename = argv[1];
-  if (size_t pos = basename.find_last_of('.');
-      pos != string::npos)
-    basename.erase(pos);
+  /* Calling `string()` method on filename because of bug in GCC/MinGW 10.2
+     (shipped in Debian “Bullseye” 11), that fails to accept implicit
+     conversion to string from filename::path. */
+  const string basename {filename.stem().string()};
 
   // Forbid some basenames, since they will cause trouble (see preprocessor#62)
   set<string> forbidden_basenames = { "T", "y", "x", "params", "steady_state", "it_", "true" };
@@ -469,8 +470,7 @@ main(int argc, char **argv)
    * Macro-expand MOD file
    */
   stringstream macro_output =
-    macroExpandModFile(filename, basename, modfile, debug, save_macro,
-                       move(save_macro_file), line_macro,
+    macroExpandModFile(filename, modfile, debug, save_macro, move(save_macro_file), line_macro,
                        defines, move(paths));
 
   if (only_macro)
diff --git a/src/MacroExpandModFile.cc b/src/MacroExpandModFile.cc
index 09dc03486bcd91bc58ad12380370f2557a6cd123..d12e104ca8c2cf20be54bd2c2cd4cc1010eab211 100644
--- a/src/MacroExpandModFile.cc
+++ b/src/MacroExpandModFile.cc
@@ -26,8 +26,8 @@
 #include "macro/Driver.hh"
 
 stringstream
-macroExpandModFile(const string &filename, const string &basename, const istream &modfile,
-                   bool debug, bool save_macro, string save_macro_file, bool line_macro,
+macroExpandModFile(const filesystem::path &filename, const istream &modfile,
+                   bool debug, bool save_macro, filesystem::path save_macro_file, bool line_macro,
                    const vector<pair<string, string>> &defines,
                    vector<filesystem::path> paths)
 {
@@ -35,15 +35,18 @@ macroExpandModFile(const string &filename, const string &basename, const istream
   stringstream macro_output;
   macro::Environment env = macro::Environment();
   macro::Driver m;
-  m.parse(filename, modfile, debug, defines, env, paths, macro_output);
+  /* Calling `string()` method on filename because of bug in GCC/MinGW 10.2
+     (shipped in Debian “Bullseye” 11), that fails to accept implicit
+     conversion to string from filename::path. */
+  m.parse(filename.string(), modfile, debug, defines, env, paths, macro_output);
   if (save_macro)
     {
       if (save_macro_file.empty())
-        save_macro_file = basename + "-macroexp.mod";
+        save_macro_file = filename.stem().string() + "-macroexp.mod";
       ofstream macro_output_file{save_macro_file};
       if (macro_output_file.fail())
         {
-          cerr << "Cannot open " << save_macro_file << " for macro output" << endl;
+          cerr << "Cannot open " << save_macro_file.string() << " for macro output" << endl;
           exit(EXIT_FAILURE);
         }
 
diff --git a/src/ModFile.cc b/src/ModFile.cc
index 326155b27f8425a11e1f4da083fe8caa4702a62d..925694d228e5a2016c9548f887cb2cab5f674179 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -1257,11 +1257,11 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
         }
 
       filesystem::create_directories(basename + "/model/json");
-      string fname{basename + "/model/json/modfile.json"};
+      const filesystem::path fname {basename + "/model/json/modfile.json"};
       ofstream jsonOutputFile{fname, ios::out | ios::binary};
       if (!jsonOutputFile.is_open())
         {
-          cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
+          cerr << "ERROR: Can't open file " << fname.string() << " for writing" << endl;
           exit(EXIT_FAILURE);
         }
 
@@ -1272,11 +1272,11 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
         {
           if (basename.size())
             {
-              string fname{basename + "/model/json/modfile-original.json"};
+              const filesystem::path fname {basename + "/model/json/modfile-original.json"};
               jsonOutputFile.open(fname, ios::out | ios::binary);
               if (!jsonOutputFile.is_open())
                 {
-                  cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
+                  cerr << "ERROR: Can't open file " << fname.string() << " for writing" << endl;
                   exit(EXIT_FAILURE);
                 }
             }
@@ -1293,11 +1293,11 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
         {
           if (basename.size())
             {
-              string fname{basename + "/model/json/steady_state_model.json"};
+              const filesystem::path fname {basename + "/model/json/steady_state_model.json"};
               jsonOutputFile.open(fname, ios::out | ios::binary);
               if (!jsonOutputFile.is_open())
                 {
-                  cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
+                  cerr << "ERROR: Can't open file " << fname.string() << " for writing" << endl;
                   exit(EXIT_FAILURE);
                 }
             }
@@ -1368,12 +1368,12 @@ ModFile::writeJsonComputingPassOutput(const string &basename, JsonFileOutputType
 }
 
 void
-ModFile::writeJsonFileHelper(const string &fname, ostringstream &output) const
+ModFile::writeJsonFileHelper(const filesystem::path &fname, ostringstream &output) const
 {
   ofstream jsonOutput{fname, ios::out | ios::binary};
   if (!jsonOutput.is_open())
     {
-      cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
+      cerr << "ERROR: Can't open file " << fname.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
   jsonOutput << output.str();
diff --git a/src/ModFile.hh b/src/ModFile.hh
index e565141a0c6c3f280373fb0e5a13c78ff9df613c..a4e69d4d5c521c043f220c8fd033831786d2278d 100644
--- a/src/ModFile.hh
+++ b/src/ModFile.hh
@@ -24,6 +24,7 @@
 #include <ctime>
 #include <iostream>
 #include <sstream>
+#include <filesystem>
 
 #include "SymbolTable.hh"
 #include "NumericalConstants.hh"
@@ -125,7 +126,7 @@ private:
   //! Functions used in writing of JSON outut. See writeJsonOutput
   void writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType json_output_mode, bool transformpass, bool computingpass) const;
   void writeJsonComputingPassOutput(const string &basename, JsonFileOutputType json_output_mode, bool jsonderivsimple) const;
-  void writeJsonFileHelper(const string &fname, ostringstream &output) const;
+  void writeJsonFileHelper(const filesystem::path &fname, ostringstream &output) const;
   /* Generate a random temporary path, in the current directory. Equivalent to
      boost::filesystem::unique_path(). Both are insecure, but currently there
      is no better portable solution. Maybe in a later C++ standard? */
diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc
index ef78b7d95526d09ca838eefea553df650d137abf..8b410ba0ead071200ce0a6f78cc0273b5c019c2b 100644
--- a/src/ModelEquationBlock.cc
+++ b/src/ModelEquationBlock.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2022 Dynare Team
+ * Copyright © 2010-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -163,20 +163,20 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
 {
   filesystem::create_directories(basename + "/latex");
 
-  string filename = basename + "/latex/steady_state.tex";
-  string content_filename = basename + "/latex/steady_state_content.tex";
+  const filesystem::path filename {basename + "/latex/steady_state.tex"},
+    content_filename {basename + "/latex/steady_state_content.tex"};
 
   ofstream output{filename, ios::out | ios::binary};
   if (!output.is_open())
     {
-      cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
+      cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
 
   ofstream content_output{content_filename, ios::out | ios::binary};
   if (!content_output.is_open())
     {
-      cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
+      cerr << "ERROR: Can't open file " << content_filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
 
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index ee42a36baa701ca3b951c9d9eecdbb5aba3bb6a2..ba82c44df86a3d6a33f2f89b8d9f21b1184a4ff6 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -1267,12 +1267,12 @@ ModelTree::writeJsonModelLocalVariables(ostream &output, bool write_tef_terms, d
 }
 
 int
-ModelTree::writeBytecodeBinFile(const string &filename, bool is_two_boundaries) const
+ModelTree::writeBytecodeBinFile(const filesystem::path &filename, bool is_two_boundaries) const
 {
   ofstream SaveCode { filename, ios::out | ios::binary };
   if (!SaveCode.is_open())
     {
-      cerr << R"(Error : Can't open file ")" << filename << R"(" for writing)" << endl;
+      cerr << R"(Error : Can't open file ")" << filename.string() << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
   int u_count {0};
@@ -1349,19 +1349,19 @@ ModelTree::writeLatexModelFile(const string &mod_basename, const string &latex_b
 {
   filesystem::create_directories(mod_basename + "/latex");
 
-  string filename = mod_basename + "/latex/" + latex_basename + ".tex";
-  string content_filename = mod_basename + "/latex/" + latex_basename + "_content" + ".tex";
+  const filesystem::path filename {mod_basename + "/latex/" + latex_basename + ".tex"},
+    content_filename {mod_basename + "/latex/" + latex_basename + "_content" + ".tex"};
   ofstream output{filename, ios::out | ios::binary};
   if (!output.is_open())
     {
-      cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
+      cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
 
   ofstream content_output{content_filename, ios::out | ios::binary};
   if (!content_output.is_open())
     {
-      cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
+      cerr << "ERROR: Can't open file " << content_filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }
 
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index 6156a511f1a28248d7c4e959e34fea14c1399d90..7f41020f5715cd7479a7b0c945a53dad941e7569 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -305,7 +305,7 @@ protected:
   /* Adds information for (non-block) bytecode simulation in a separate .bin
      file.
      Returns the number of first derivatives w.r.t. endogenous variables */
-  int writeBytecodeBinFile(const string &filename, bool is_two_boundaries) const;
+  int writeBytecodeBinFile(const filesystem::path &filename, bool is_two_boundaries) const;
   //! Adds per-block information for bytecode simulation in a separate .bin file
   int writeBlockBytecodeBinFile(ofstream &bin_file, int block) const;
 
diff --git a/src/NumericalInitialization.cc b/src/NumericalInitialization.cc
index 51e40da3c5af993e89baee2303479d3fb999fd05..f8b1d6b9c8ea29ee1b98d8c5770ac700b5859cc6 100644
--- a/src/NumericalInitialization.cc
+++ b/src/NumericalInitialization.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -611,18 +611,18 @@ SaveParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
          << "}";
 }
 
-LoadParamsAndSteadyStateStatement::LoadParamsAndSteadyStateStatement(const string &filename,
+LoadParamsAndSteadyStateStatement::LoadParamsAndSteadyStateStatement(const filesystem::path &filename,
                                                                      const SymbolTable &symbol_table_arg,
                                                                      WarningConsolidation &warnings) :
   symbol_table{symbol_table_arg}
 {
-  cout << "Reading " << filename << "." << endl;
+  cout << "Reading " << filename.string() << "." << endl;
 
   ifstream f;
   f.open(filename, ios::in);
   if (f.fail())
     {
-      cerr << "ERROR: Can't open " << filename << endl;
+      cerr << "ERROR: Can't open " << filename.string() << endl;
       exit(EXIT_FAILURE);
     }
 
@@ -640,7 +640,7 @@ LoadParamsAndSteadyStateStatement::LoadParamsAndSteadyStateStatement(const strin
         }
       catch (SymbolTable::UnknownSymbolNameException &e)
         {
-          warnings << "WARNING: Unknown symbol " << symb_name << " in " << filename << endl;
+          warnings << "WARNING: Unknown symbol " << symb_name << " in " << filename.string() << endl;
         }
     }
   f.close();
diff --git a/src/NumericalInitialization.hh b/src/NumericalInitialization.hh
index 6c9c1278128e189a267729bb1994b848418ac5a2..fff69c74808b738074fffa8338d154d527ac9e5c 100644
--- a/src/NumericalInitialization.hh
+++ b/src/NumericalInitialization.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -23,6 +23,7 @@
 #include <string>
 #include <vector>
 #include <map>
+#include <filesystem>
 
 #include "SymbolTable.hh"
 #include "ExprNode.hh"
@@ -198,7 +199,7 @@ private:
   /*! Maps symbol ID to numeric value (stored as string) */
   map<int, string> content;
 public:
-  LoadParamsAndSteadyStateStatement(const string &filename,
+  LoadParamsAndSteadyStateStatement(const filesystem::path &filename,
                                     const SymbolTable &symbol_table_arg,
                                     WarningConsolidation &warnings);
   void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index 8fc55def7265b70cc7424c7bbcaf186198a7e8db..2c993b4df8431aeebba42926e5ee73797159531e 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2022 Dynare Team
+ * Copyright © 2003-2023 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -240,7 +240,7 @@ StaticModel::writeStaticPerBlockCFiles(const string &basename, const string &mex
       ofstream header_output{filename, ios::out | ios::binary};
       if (!header_output.is_open())
         {
-          cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
+          cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
           exit(EXIT_FAILURE);
         }
       header_output << header.str() << ';' << endl;
@@ -285,11 +285,11 @@ StaticModel::writeStaticBlockBytecode(const string &basename) const
 {
   BytecodeWriter code_file {basename + "/model/bytecode/static.cod"};
 
-  const string bin_filename {basename + "/model/bytecode/static.bin"};
+  const filesystem::path bin_filename {basename + "/model/bytecode/static.bin"};
   ofstream bin_file {bin_filename, ios::out | ios::binary};
   if (!bin_file.is_open())
     {
-      cerr << R"(Error : Can't open file ")" << bin_filename << R"(" for writing)" << endl;
+      cerr << R"(Error : Can't open file ")" << bin_filename.string() << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
 
@@ -738,12 +738,12 @@ StaticModel::writeStaticBlockMFile(const string &basename) const
 void
 StaticModel::writeStaticBlockCFile(const string &basename, vector<filesystem::path> per_block_object_files, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot) const
 {
-  string filename = basename + "/model/src/static.c";
+  const filesystem::path filename {basename + "/model/src/static.c"};
 
   ofstream output{filename, ios::out | ios::binary};
   if (!output.is_open())
     {
-      cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
+      cerr << "ERROR: Can't open file " << filename.string() << " for writing" << endl;
       exit(EXIT_FAILURE);
     }