Skip to content

✨ feat: add user_projects_dir for $XDG_PROJECTS_DIR#490

Merged
gaborbernat merged 1 commit into
mainfrom
485
May 27, 2026
Merged

✨ feat: add user_projects_dir for $XDG_PROJECTS_DIR#490
gaborbernat merged 1 commit into
mainfrom
485

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

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 and issue xdg-user-dirs#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.

The XDG user-dirs spec added XDG_PROJECTS_DIR in xdg-user-dirs 0.0.4
and recently wired it up fully (commit 217cae71 upstream). Closes #485.

Follows the same pattern as user_documents_dir and other media dirs:
Unix reads from user-dirs.dirs via _get_user_media_dir, XDGMixin
overrides with the env var, and all other platforms default to ~/Projects
since no native shell folder exists for projects on macOS, Windows, or
Android.
@gaborbernat gaborbernat requested a review from ofek as a code owner May 27, 2026 22:11
@gaborbernat gaborbernat added the enhancement New feature or request label May 27, 2026
@gaborbernat gaborbernat merged commit d279747 into main May 27, 2026
32 checks passed
@gaborbernat gaborbernat deleted the 485 branch May 27, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New "Projects" directory defined in $XDG_PROJECTS_DIR

1 participant