platformdirs: introduce user_pictures_dir()
#167
Merged
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.
Introduces the means to acquire the user's pictures directory path.
Feature suggested in #141.
I have included tests (thanks to
user_documents_dir
much of the code including testing code was borrowed). I did test this on Windows and MacOS and from calling this function they do produce expected results. However I'm not familiar with Android with the exception of some of the developer web pages I explored that allowed me to find theDIRECTORY_PICTURES
constant, and I also don't have access to an Android device so I have not tested it in a similar manner as Windows and MacOS.The following are just references to the code changes I made that I thought were worth mentioning:
Android:
Environment.DIRECTORY_PICTURES
: https://developer.android.com/reference/android/os/Environment#DIRECTORY_PICTURES/storage/emulated/0/Pictures
(found this path across different problems discussed in this site): https://android.stackexchange.com/questions/102962/with-the-stock-gallery-app-how-can-i-open-an-arbitrary-image-file-by-specifyingUnix:
XDG_PICTURES_DIR
: https://wiki.archlinux.org/title/XDG_user_directoriesWindows:
CSIDL_MYPICTURES
%USERPROFILE%\Pictures
(the fallback inget_win_folder_from_env_vars()
): https://github.com/adrg/xdg/blob/master/README.md#xdg-user-directoriesMy Pictures
, I used regedit and found this name there.