From 43b24facb98cdddc3db1e81bbca349b25f8b20af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 12 Dec 2023 17:07:05 +0100
Subject: [PATCH] Configuration file: new default location; new default value
 for GlobalInitFile

Under Linux and macOS, the default location for the configuration file is now
dynare/dynare.ini under the configuration directories as defined by the XDG
specification. Under Windows, the default configuration file is now
%APPDATA%\dynare\dynare.ini.

There is now a default value for the global initialization file (GlobalInitFile
option of the configuration file): the global_init.m in the Dynare
configuration directory.
---
 doc/manual/source/the-configuration-file.rst | 26 ++++++++++++++------
 preprocessor                                 |  2 +-
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/doc/manual/source/the-configuration-file.rst b/doc/manual/source/the-configuration-file.rst
index d38c5be1c3..4c33aa4857 100644
--- a/doc/manual/source/the-configuration-file.rst
+++ b/doc/manual/source/the-configuration-file.rst
@@ -15,11 +15,16 @@ related to the model (and hence not placed in the model file). At the
 moment, it is only used when using Dynare to run parallel
 computations.
 
-On Linux and macOS, the default location of the configuration file is
-``$HOME/.dynare``, while on Windows it is ``%APPDATA%\dynare.ini``
-(typically ``c:\Users\USERNAME\AppData\dynare.ini``). You
-can specify a non standard location using the ``conffile`` option of
-the ``dynare`` command (see :ref:`dyn-invoc`).
+On Linux and macOS, the configuration file is searched by default under
+``dynare/dynare.ini`` in the configuration directories defined by the XDG
+specification (typically ``$HOME/.config/dynare/dynare.ini`` for the
+user-specific configuration and ``/etc/xdg/dynare/dynare.ini`` for the
+system-wide configuration, the former having precedence over the latter). Under
+Windows, the configuration file it searched by default in
+``%APPDATA%\dynare\dynare.ini`` (typically
+``c:\Users\USERNAME\AppData\Roaming\dynare\dynare.ini``). You can specify a non
+standard location using the ``conffile`` option of the ``dynare`` command (see
+:ref:`dyn-invoc`).
 
 The parsing of the configuration file is case-sensitive and it should
 take the following form, with each option/choice pair placed on a
@@ -76,8 +81,15 @@ processing. Currently, there is only one option available.
 
     .. option:: GlobalInitFile = PATH_AND_FILE
 
-        The location of the global initialization file to be run at
-        the end of ``global_initialization.m``.
+        The location of a global initialization file that can be used to
+        customize some Dynare internals (typically default option values). This
+        is a MATLAB/Octave script.
+
+        If this option is not specified, Dynare will look for a
+        ``global_init.m`` file in its configuration directory (typically
+        ``$HOME/.config/dynare/global_init.m`` under Linux and macOS, and
+        ``c:\Users\USERNAME\AppData\Roaming\dynare\global_init.m`` under
+        Windows).
 
     *Example*
 
diff --git a/preprocessor b/preprocessor
index 378d00fc3a..cd86b1895d 160000
--- a/preprocessor
+++ b/preprocessor
@@ -1 +1 @@
-Subproject commit 378d00fc3a50a11c3dce615ea337ad55989c938e
+Subproject commit cd86b1895d97d1b195849072a8d26fd372ca5d8c
-- 
GitLab