pub fn data_dir(app: &str) -> Option<PathBuf>Expand description
Where application app keeps its own data: records, caches it wants to survive, files it
wrote itself. Records are not settings, so they do not live next to them.
- Linux and other Unix systems:
$XDG_DATA_HOME/<app>whenXDG_DATA_HOMEis an absolute path, else$HOME/.local/share/<app>. - macOS:
$HOME/Library/Application Support/<app>, the same folder as the settings. macOS has no separate data folder for a command line application, and the framework does not invent one. - Windows:
%LOCALAPPDATA%\<app>, the local folder, so records are not copied between machines by a roaming profile.
None when the platform’s variables say nothing, and when HOME is not an absolute path.
The folder is not created and does not have to exist.