@@ -141,27 +141,27 @@ Use ``user_log_dir`` and ``site_log_dir`` for application logs:
141141 format = " %(asctime)s - %(levelname)s - %(message)s " ,
142142 )
143143
144- ******************************
144+ ************************
145145 User media directories
146- ******************************
146+ ************************
147147
148- Unlike app dirs (data, config, cache, etc.), media dirs are **not ** scoped to the app name. They point to
149- standard user-facing folders that exist independently of any particular application. Use them when your app
150- needs to read from or save into a folder the user already expects — not when storing application state.
148+ Unlike app dirs (data, config, cache, etc.), media dirs are **not ** scoped to the app name. They point to standard
149+ user-facing folders that exist independently of any particular application. Use them when your app needs to read from or
150+ save into a folder the user already expects — not when storing application state.
151151
152152The distinction matters:
153153
154154- ``user_data_dir("MyApp") `` → ``~/.local/share/MyApp `` — your app's private storage
155155- ``user_documents_dir() `` → ``~/Documents `` — the user's document library
156156
157157On Linux, media dirs are defined by the `XDG user-dirs specification
158- <https://www.freedesktop.org/wiki/Software/xdg-user-dirs/> `_ and stored in ``~/.config/user-dirs.dirs ``.
159- The ``xdg-user-dirs `` tool lets users relocate them. Set the corresponding environment variable
160- (`` XDG_DOCUMENTS_DIR ``, `` XDG_DOWNLOAD_DIR ``, etc.) to override on a per-session basis. On macOS and
161- Windows, `` platformdirs `` returns the platform-conventional location.
158+ <https://www.freedesktop.org/wiki/Software/xdg-user-dirs/> `_ and stored in ``~/.config/user-dirs.dirs ``. The
159+ ``xdg-user-dirs `` tool lets users relocate them. Set the corresponding environment variable (`` XDG_DOCUMENTS_DIR ``,
160+ `` XDG_DOWNLOAD_DIR ``, etc.) to override on a per-session basis. On macOS and Windows, `` platformdirs `` returns the
161+ platform-conventional location.
162162
163163Media and user-facing directories
164- ==================================
164+ =================================
165165
166166Use these when your app saves or opens files the user should see in their own folders:
167167
@@ -182,32 +182,31 @@ Use these when your app saves or opens files the user should see in their own fo
182182 <https://gitlab.freedesktop.org/xdg/xdg-user-dirs/-/commit/217cae71c620ed2b3ed2936256ece68defccc6ab> `_.
183183
184184``user_publicshare_dir `` (``XDG_PUBLICSHARE_DIR ``)
185- Files shared with other local accounts. On Windows this is the machine-wide ``C:\Users\Public ``
186- (`` %PUBLIC% ``), not a per-user directory.
185+ Files shared with other local accounts. On Windows this is the machine-wide ``C:\Users\Public `` (`` %PUBLIC% ``), not
186+ a per-user directory.
187187
188188.. code-block :: python
189189
190190 from platformdirs import user_documents_path
191191
192192 report = user_documents_path() / " report.pdf"
193193
194- Do not use these to store application state or config — if the file would confuse the user when they browse
195- the folder, it belongs in ``user_data_dir `` instead.
194+ Do not use these to store application state or config — if the file would confuse the user when they browse the folder,
195+ it belongs in ``user_data_dir `` instead.
196196
197197Templates
198198=========
199199
200- ``user_templates_dir `` (``XDG_TEMPLATES_DIR ``) points to the folder used by file managers for new-file
201- templates. macOS has no platform-defined templates directory; ``~/Templates `` is returned as a pragmatic
202- fallback.
200+ ``user_templates_dir `` (``XDG_TEMPLATES_DIR ``) points to the folder used by file managers for new-file templates. macOS
201+ has no platform-defined templates directory; ``~/Templates `` is returned as a pragmatic fallback.
203202
204203Fonts
205204=====
206205
207206``user_fonts_dir `` points to the per-user font installation directory:
208207
209- - **Linux **: ``$XDG_DATA_HOME/fonts `` (default ``~/.local/share/fonts ``) — derived from ``$XDG_DATA_HOME ``,
210- not a dedicated env var. See the `XDG Base Directory Specification
208+ - **Linux **: ``$XDG_DATA_HOME/fonts `` (default ``~/.local/share/fonts ``) — derived from ``$XDG_DATA_HOME ``, not a
209+ dedicated env var. See the `XDG Base Directory Specification
211210 <https://specifications.freedesktop.org/basedir/latest/> `_.
212211- **macOS **: ``~/Library/Fonts ``
213212- **Windows **: ``%LOCALAPPDATA%\Microsoft\Windows\Fonts `` — the per-user font location added in Windows 10
@@ -225,19 +224,18 @@ Fonts
225224 Preference directory
226225**********************
227226
228- ``user_preference_dir `` is meaningful mainly on macOS, where Apple's conventions distinguish two separate
229- locations:
227+ ``user_preference_dir `` is meaningful mainly on macOS, where Apple's conventions distinguish two separate locations:
230228
231229- ``~/Library/Application Support/AppName `` — long-term application data, databases, plug-ins
232230- ``~/Library/Preferences/AppName `` — user-adjustable preference files (historically ``.plist ``)
233231
234- On Linux and Windows, ``user_preference_dir `` is an alias for ``user_config_dir `` — the XDG and Windows
235- conventions make no such distinction. On Android, it also aliases ``user_config_dir ``.
232+ On Linux and Windows, ``user_preference_dir `` is an alias for ``user_config_dir `` — the XDG and Windows conventions make
233+ no such distinction. On Android, it also aliases ``user_config_dir ``.
236234
237235Use ``user_preference_dir `` when you specifically need to follow Apple's `File System Programming Guide
238236<https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html> `_
239- and store preference files in ``~/Library/Preferences ``. For most cross-platform applications
240- `` user_config_dir `` is sufficient.
237+ and store preference files in ``~/Library/Preferences ``. For most cross-platform applications `` user_config_dir `` is
238+ sufficient.
241239
242240**************************
243241 User vs site directories
0 commit comments