✨ feat: add user_projects_dir for $XDG_PROJECTS_DIR#490
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The XDG user-dirs spec added
XDG_PROJECTS_DIRin xdg-user-dirs 0.0.4 and recently wired it up fully (see commit 217cae71 and issue xdg-user-dirs#3). Other ecosystems (Rustdirs, Javadirectories-jvm) already expose this. Closes #485.The implementation follows the same pattern as
user_documents_dirand other XDG user-dirs: on Linux,unix.pyreads fromuser-dirs.dirsvia_get_user_media_dir("XDG_PROJECTS_DIR", "~/Projects"),XDGMixinin_xdg.pyhandles the env var override, and all other platforms (macOS, Windows, Android) fall back to~/Projectssince no native shell folder exists for projects on those platforms.Both
user_projects_dir(str) anduser_projects_path(Path) are exposed as properties, module-level convenience functions, and documented inapi.rstandplatforms.rst.