pub fn documents_dir() -> Option<PathBuf>Expand description
The user’s Documents folder, where an application puts files the user made and wants to find again in a file manager: projects, exports, notes.
- Linux and other Unix systems: the
XDG_DOCUMENTS_DIRline ofuser-dirs.dirsin the config root ($XDG_CONFIG_HOMEwhen it is an absolute path, else$HOME/.config), which is where a desktop records the folder’s name in the user’s language, such as$HOME/Belgeler. A missing or unreadable file, a line that does not follow the format, and a line that names the home folder itself (the way that file turns a folder off) all give$HOME/Documents. - macOS:
$HOME/Documents. - Windows: the Documents Known Folder, which the user can move to another drive; when the
system does not answer,
%USERPROFILE%\Documents.
None when there is no home folder to put it in. A HOME that is not an absolute path
counts as missing, as it does for config_dir. The folder is not created
and does not have to exist.