@@ -161,30 +161,86 @@ Some automatic "answerers" (if set, they automatically answer confirmation quest
161161.. _XDG env var: https://specifications.freedesktop.org/basedir-spec/0.6/ar01s03.html
162162
163163Directories and files:
164+
165+ .. note::
166+
167+ Borg 2 uses the `platformdirs < https: //pypi.org/project/platformdirs/> `_ library to determine
168+ default directory locations. This means that default paths are **platform-specific**:
169+
170+ - **Linux**: Uses XDG Base Directory Specification paths (e.g., ``~/.config/borg``,
171+ ``~/.cache/borg``, ``~/.local/share/borg``). `XDG env var`_ variables are honoured.
172+ - **macOS**: Uses native macOS directories (e.g., ``~/Library/Application Support/borg``,
173+ ``~/Library/Caches/borg``). `XDG env var`_ variables are **not** honoured.
174+ - **Windows**: Uses Windows AppData directories (e.g., ``C:\Users\< user > \AppData\Roaming\borg``,
175+ ``C:\Users\< user > \AppData\Local\borg``). `XDG env var`_ variables are **not** honoured.
176+
177+ On all platforms, you can override each directory individually using the specific environment
178+ variables described below. You can also set ``BORG_BASE_DIR`` to force borg to use
179+ ``BORG_BASE_DIR/.config/borg``, ``BORG_BASE_DIR/.cache/borg``, etc., regardless of the platform.
180+
181+ Default directory locations by platform (when no ``BORG_*`` environment variables are set):
182+
183+ .. list-table::
184+ :header-rows: 1
185+ :widths: 15 25 30 30
186+
187+ * - Directory
188+ - Linux
189+ - macOS
190+ - Windows
191+ * - Config
192+ - ``~/.config/borg``
193+ - ``~/Library/Application Support/borg``
194+ - ``%APPDATA%\borg``
195+ * - Cache
196+ - ``~/.cache/borg``
197+ - ``~/Library/Caches/borg``
198+ - ``%LOCALAPPDATA%\borg\Cache``
199+ * - Data
200+ - ``~/.local/share/borg``
201+ - ``~/Library/Application Support/borg``
202+ - ``%LOCALAPPDATA%\borg``
203+ * - Runtime
204+ - ``/run/user/< uid > /borg``
205+ - ``~/Library/Caches/TemporaryItems/borg``
206+ - ``%TEMP%\borg``
207+ * - Keys
208+ - ``< config _dir > /keys``
209+ - ``< config _dir > /keys``
210+ - ``< config _dir > \keys``
211+ * - Security
212+ - ``< data _dir > /security``
213+ - ``< data _dir > /security``
214+ - ``< data _dir > \security``
215+
164216 BORG_BASE_DIR
165217 Defaults to ``$HOME`` or ``~$USER`` or ``~`` (in that order).
166218 If you want to move all borg-specific folders to a custom path at once, all you need to do is
167219 to modify ``BORG_BASE_DIR``: the other paths for cache, config etc. will adapt accordingly
168220 (assuming you didn't set them to a different custom value).
169221 BORG_CACHE_DIR
170- Defaults to ``$BORG_BASE_DIR/.cache/borg``. If ``BORG_BASE_DIR`` is not explicitly set while
171- `XDG env var`_ ``XDG_CACHE_HOME`` is set, then ``$XDG_CACHE_HOME/borg`` is being used instead.
222+ Defaults to the platform-specific cache directory (see table above).
223+ If ``BORG_BASE_DIR`` is set, defaults to ``$BORG_BASE_DIR/.cache/borg``.
224+ On Linux, `XDG env var`_ ``XDG_CACHE_HOME`` is also honoured if ``BORG_BASE_DIR`` is not set.
172225 This directory contains the local cache and might need a lot
173226 of space for dealing with big repositories. Make sure you're aware of the associated
174227 security aspects of the cache location: :ref:`cache_security`
175228 BORG_CONFIG_DIR
176- Defaults to ``$BORG_BASE_DIR/.config/borg``. If ``BORG_BASE_DIR`` is not explicitly set while
177- `XDG env var `_ ``XDG_CONFIG_HOME`` is set , then ``$XDG_CONFIG_HOME/borg`` is being used instead.
229+ Defaults to the platform-specific config directory (see table above).
230+ If ``BORG_BASE_DIR`` is set, defaults to ``$BORG_BASE_DIR/.config/borg``.
231+ On Linux, `XDG env var`_ ``XDG_CONFIG_HOME`` is also honoured if ``BORG_BASE_DIR`` is not set.
178232 This directory contains all borg configuration directories, see the FAQ
179233 for a security advisory about the data in this directory: :ref:`home_config_borg`
180234 BORG_DATA_DIR
181- Defaults to ``$BORG_BASE_DIR/.local/share/borg``. If ``BORG_BASE_DIR`` is not explicitly set while
182- `XDG env var `_ ``XDG_DATA_HOME`` is set , then ``$XDG_DATA_HOME/borg`` is being used instead.
235+ Defaults to the platform-specific data directory (see table above).
236+ If ``BORG_BASE_DIR`` is set, defaults to ``$BORG_BASE_DIR/.local/share/borg``.
237+ On Linux, `XDG env var`_ ``XDG_DATA_HOME`` is also honoured if ``BORG_BASE_DIR`` is not set.
183238 This directory contains all borg data directories, see the FAQ
184239 for a security advisory about the data in this directory: :ref:`home_data_borg`
185240 BORG_RUNTIME_DIR
186- Defaults to ``$BORG_BASE_DIR/.cache/borg``. If ``BORG_BASE_DIR`` is not explicitly set while
187- `XDG env var `_ ``XDG_RUNTIME_DIR`` is set , then ``$XDG_RUNTIME_DIR/borg`` is being used instead.
241+ Defaults to the platform-specific runtime directory (see table above).
242+ If ``BORG_BASE_DIR`` is set, defaults to ``$BORG_BASE_DIR/.cache/borg``.
243+ On Linux, `XDG env var`_ ``XDG_RUNTIME_DIR`` is also honoured if ``BORG_BASE_DIR`` is not set.
188244 This directory contains borg runtime files, like e.g. the socket file.
189245 BORG_SECURITY_DIR
190246 Defaults to ``$BORG_DATA_DIR/security``.
0 commit comments