Dire
Complete cross-platform solution for data and user directories discovery.
|
#include <user.hpp>
Static Public Member Functions | |
static auto | make () -> Optional< UserDirsBundle > |
Public Attributes | |
Path | audio_dir |
Path | desktop_dir |
Path | document_dir |
Path | download_dir |
Path | picture_dir |
Path | video_dir |
Path | public_dir |
Optional< Path > | font_dir |
Optional< Path > | template_dir |
A bundle of all user directories.
User directories are directories mostly used by the user and user programs.
template_dir
doesn't exist on linux systems.
font_dir
doesn't exists on windows.
|
static |
Path dire::UserDirsBundle::audio_dir |
Typically used to store audio files, programs which download and/or work with audio files may also use it.
Platform | Method | Example |
---|---|---|
Linux | $XDG_MUSIC_DIR | /home/foo/Music |
Mac | home_dir() + "/Music" | /Users/Foo/Music |
Windows | Known Folder API FOLDERID_Music | C:\Users\Foo\Music |
Path dire::UserDirsBundle::desktop_dir |
This is the directory whose contents are displayed on the desktop (on Linux desktops are not always available, which is typically the case for Tiling Window Managers).
Platform | Method | Example |
---|---|---|
Linux | $XDG_DESKTOP_DIR | /home/foo/Desktop |
Mac | home_dir() + "/Desktop" | /Users/Foo/Desktop |
Windows | Known Folder API FOLDERID_Desktop | C:\Users\Foo\Desktop |
Path dire::UserDirsBundle::document_dir |
Used mostly for plaintext and text processor documents. Lots of other programs may use it as well, especially ones made for designing.
Platform | Method | Example |
---|---|---|
Linux | $XDG_DOCUMENTS_DIR | /home/foo/Documents |
Mac | home_dir() + "/Documents" | /Users/Foo/Documents |
Windows | Known Folder API FOLDERID_Documents | C:\Users\Foo\Documents |
Path dire::UserDirsBundle::download_dir |
Mostly used by browsers for saved files. Some other programs may utilize it as well.
Platform | Method | Example |
---|---|---|
Linux | $XDG_DOWNLOAD_DIR | /home/foo/Downloads |
Mac | home_dir() + "/Downloads" | /Users/Foo/Downloads |
Windows | Known Folder API FOLDERID_Downloads | C:\Users\Foo\Downloads |
Directory for font files.
It doesn't exist on windows, as it doesn't have a one, standard directory for fonts.
They are typically put and found in \WINDIR%\Fonts
- typically C:\Windows\Fonts
or \LOCALAPPDATA%\Microsoft\Windows\Fonts\
- typically C:\Users\Foo\AppData\Local\Microsoft\Windows\Fonts
.
Platform | Method | Example |
---|---|---|
Linux | $XDG_DATA_HOME /fonts or $HOME/.local/share/fonts | /home/foo/Public |
Mac | home_dir() + "/Library/Fonts" | /Users/Foo/Library/Fonts |
Windows | nullopt | nullopt |
Path dire::UserDirsBundle::picture_dir |
Typically used by programs for downloading and manipulating images.
Platform | Method | Example |
---|---|---|
Linux | $XDG_PICTURES_DIR | /home/foo/Pictures |
Mac | home_dir() + "/Pictures" | /Users/Foo/Pictures |
Windows | Known Folder API FOLDERID_Pictures | C:\Users\Foo\Pictures |
Path dire::UserDirsBundle::public_dir |
A directory that all users have access to. This is especially useful for windows and mac which have native solutions for sharing these over network.
Platform | Method | Example |
---|---|---|
Linux | $XDG_PUBLICSHARE_DIR | /home/foo/Public |
Mac | home_dir() + "/Public" | /Users/Foo/Public |
Windows | Known Folder API FOLDERID_Public | C:\Users\Foo\Public |
Directory for user template files.
On linux users can drop all kinds of template files there, which the desktop environment then picks up and allows creating new documents based on them from a contextual menu.
On windows this folder is typically dependent on user programs, like the software from the Microsoft suite or its other alternatives - which means there's a bigger chance for it to fail!
Platform | Method | Example |
---|---|---|
Linux | $XDG_TEMPLATES_DIR | /home/foo/Templates |
Mac | nullopt | nullopt |
Windows | Known Folder API FOLDERID_Templates | C:\Users\Alice\AppData\Roaming\Microsoft\Windows\Templates |
Path dire::UserDirsBundle::video_dir |
Typically used by programs for downloading videos.
Mac has a special case here and names the dir Movies
Platform | Method | Example |
---|---|---|
Linux | $XDG_VIDEOS_DIR | /home/foo/Videos |
Mac | home_dir() + "/Pictures" | /Users/Foo/Movies |
Windows | Known Folder API FOLDERID_Videos | C:\Users\Foo\Videos |