SIGN IN SIGN UP

✨ feat: add user_projects_dir for $XDG_PROJECTS_DIR (#490)

The XDG user-dirs spec added `XDG_PROJECTS_DIR` in xdg-user-dirs 0.0.4
and recently wired it up fully (see [commit
217cae71](https://gitlab.freedesktop.org/xdg/xdg-user-dirs/-/commit/217cae71c620ed2b3ed2936256ece68defccc6ab)
and [issue
xdg-user-dirs#3](https://gitlab.freedesktop.org/xdg/xdg-user-dirs/-/work_items/3)).
Other ecosystems (Rust `dirs`, Java `directories-jvm`) already expose
this. Closes #485.

The implementation follows the same pattern as `user_documents_dir` and
other XDG user-dirs: on Linux, `unix.py` reads from `user-dirs.dirs` via
`_get_user_media_dir("XDG_PROJECTS_DIR", "~/Projects")`, `XDGMixin` in
`_xdg.py` handles the env var override, and all other platforms (macOS,
Windows, Android) fall back to `~/Projects` since no native shell folder
exists for projects on those platforms.

Both `user_projects_dir` (str) and `user_projects_path` (Path) are
exposed as properties, module-level convenience functions, and
documented in `api.rst` and `platforms.rst`.
B
Bernát Gábor committed
d27974762005fa35cebcd4dd7236f8081e88ad75
Parent: 4116391
Committed by GitHub <noreply@github.com> on 5/27/2026, 10:26:26 PM