@@ -141,52 +141,52 @@ 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
163163Documents, downloads, and media
164- ================================
164+ ===============================
165165
166166Use these dirs when saving or opening files that belong in the user's library:
167167
168168.. list-table ::
169- :widths: 30 20 50
170- :header-rows: 1
171-
172- * - Property
173- - XDG variable
174- - Typical use
175- * - ``user_documents_dir ``
176- - ``XDG_DOCUMENTS_DIR ``
177- - Exported reports, user-authored files
178- * - ``user_downloads_dir ``
179- - ``XDG_DOWNLOAD_DIR ``
180- - Files fetched from the internet at user request
181- * - ``user_pictures_dir ``
182- - ``XDG_PICTURES_DIR ``
183- - Images the user owns
184- * - ``user_videos_dir ``
185- - ``XDG_VIDEOS_DIR ``
186- - Video files the user owns
187- * - ``user_music_dir ``
188- - ``XDG_MUSIC_DIR ``
189- - Audio files the user owns
169+ :widths: 30 20 50
170+ :header-rows: 1
171+
172+ - - Property
173+ - XDG variable
174+ - Typical use
175+ - - ``user_documents_dir ``
176+ - ``XDG_DOCUMENTS_DIR ``
177+ - Exported reports, user-authored files
178+ - - ``user_downloads_dir ``
179+ - ``XDG_DOWNLOAD_DIR ``
180+ - Files fetched from the internet at user request
181+ - - ``user_pictures_dir ``
182+ - ``XDG_PICTURES_DIR ``
183+ - Images the user owns
184+ - - ``user_videos_dir ``
185+ - ``XDG_VIDEOS_DIR ``
186+ - Video files the user owns
187+ - - ``user_music_dir ``
188+ - ``XDG_MUSIC_DIR ``
189+ - Audio files the user owns
190190
191191.. code-block :: python
192192
@@ -195,48 +195,46 @@ Use these dirs when saving or opening files that belong in the user's library:
195195 # Save an exported report where the user expects documents
196196 report = user_documents_path() / " report.pdf"
197197
198- Do not use ``user_documents_dir `` to store application data or config. If the file would confuse the user if
199- they opened the folder, it belongs in ``user_data_dir `` instead.
198+ Do not use ``user_documents_dir `` to store application data or config. If the file would confuse the user if they opened
199+ the folder, it belongs in ``user_data_dir `` instead.
200200
201201Desktop, projects, and public share
202- =====================================
202+ ===================================
203203
204204.. list-table ::
205- :widths: 30 20 50
206- :header-rows: 1
207-
208- * - Property
209- - XDG variable
210- - Typical use
211- * - ``user_desktop_dir ``
212- - ``XDG_DESKTOP_DIR ``
213- - Shortcut files, launchers (rarely needed in code)
214- * - ``user_projects_dir ``
215- - ``XDG_PROJECTS_DIR ``
216- - Root directory for user's coding projects (`recently added to xdg-user-dirs
217- <https://gitlab.freedesktop.org/xdg/xdg-user-dirs/-/commit/217cae71c620ed2b3ed2936256ece68defccc6ab> `_)
218- * - ``user_publicshare_dir ``
219- - ``XDG_PUBLICSHARE_DIR ``
220- - Files shared with other users on the same machine
221-
222- On Windows, ``user_publicshare_dir `` returns ``C:\Users\Public `` (``%PUBLIC% ``) — a machine-wide shared
223- folder, not per-user. This matches what Rust ``dirs `` and Java ``directories-jvm `` return, following the
224- platform convention.
205+ :widths: 30 20 50
206+ :header-rows: 1
207+
208+ - - Property
209+ - XDG variable
210+ - Typical use
211+ - - ``user_desktop_dir ``
212+ - ``XDG_DESKTOP_DIR ``
213+ - Shortcut files, launchers (rarely needed in code)
214+ - - ``user_projects_dir ``
215+ - ``XDG_PROJECTS_DIR ``
216+ - Root directory for user's coding projects (`recently added to xdg-user-dirs
217+ <https://gitlab.freedesktop.org/xdg/xdg-user-dirs/-/commit/217cae71c620ed2b3ed2936256ece68defccc6ab> `_)
218+ - - ``user_publicshare_dir ``
219+ - ``XDG_PUBLICSHARE_DIR ``
220+ - Files shared with other users on the same machine
221+
222+ On Windows, ``user_publicshare_dir `` returns ``C:\Users\Public `` (``%PUBLIC% ``) — a machine-wide shared folder, not
223+ per-user. This matches what Rust ``dirs `` and Java ``directories-jvm `` return, following the platform convention.
225224
226225Templates
227226=========
228227
229- ``user_templates_dir `` (``XDG_TEMPLATES_DIR ``) points to the folder used by file managers for new-file
230- templates. macOS has no platform-defined templates directory; ``~/Templates `` is returned as a pragmatic
231- fallback.
228+ ``user_templates_dir `` (``XDG_TEMPLATES_DIR ``) points to the folder used by file managers for new-file templates. macOS
229+ has no platform-defined templates directory; ``~/Templates `` is returned as a pragmatic fallback.
232230
233231Fonts
234232=====
235233
236234``user_fonts_dir `` points to the per-user font installation directory:
237235
238- - **Linux **: ``$XDG_DATA_HOME/fonts `` (default ``~/.local/share/fonts ``) — derived from ``$XDG_DATA_HOME ``,
239- not a dedicated env var. See the `XDG Base Directory Specification
236+ - **Linux **: ``$XDG_DATA_HOME/fonts `` (default ``~/.local/share/fonts ``) — derived from ``$XDG_DATA_HOME ``, not a
237+ dedicated env var. See the `XDG Base Directory Specification
240238 <https://specifications.freedesktop.org/basedir/latest/> `_.
241239- **macOS **: ``~/Library/Fonts ``
242240- **Windows **: ``%LOCALAPPDATA%\Microsoft\Windows\Fonts `` — the per-user font location added in Windows 10
@@ -254,19 +252,18 @@ Fonts
254252 Preference directory
255253**********************
256254
257- ``user_preference_dir `` is meaningful mainly on macOS, where Apple's conventions distinguish two separate
258- locations:
255+ ``user_preference_dir `` is meaningful mainly on macOS, where Apple's conventions distinguish two separate locations:
259256
260257- ``~/Library/Application Support/AppName `` — long-term application data, databases, plug-ins
261258- ``~/Library/Preferences/AppName `` — user-adjustable preference files (historically ``.plist ``)
262259
263- On Linux and Windows, ``user_preference_dir `` is an alias for ``user_config_dir `` — the XDG and Windows
264- conventions make no such distinction. On Android, it also aliases ``user_config_dir ``.
260+ On Linux and Windows, ``user_preference_dir `` is an alias for ``user_config_dir `` — the XDG and Windows conventions make
261+ no such distinction. On Android, it also aliases ``user_config_dir ``.
265262
266263Use ``user_preference_dir `` when you specifically need to follow Apple's `File System Programming Guide
267264<https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html> `_
268- and store preference files in ``~/Library/Preferences ``. For most cross-platform applications
269- `` user_config_dir `` is sufficient.
265+ and store preference files in ``~/Library/Preferences ``. For most cross-platform applications `` user_config_dir `` is
266+ sufficient.
270267
271268**************************
272269 User vs site directories
0 commit comments