plat/dirs.rs#
Source: lib/plat/dirs.rs
dirs -- the user's own folders (documents, downloads, pictures ...) and the folder of logs
user_dir(DIR_DESKTOP | DIR_DOCUMENTS | DIR_DOWNLOADS | DIR_PICTURES | DIR_MUSIC | DIR_VIDEOS)
-> Option<String>
Windows: the known folders (SHGetKnownFolderPath; also when the user moved them, for
example to OneDrive). Linux: the XDG user dirs of $XDG_CONFIG_HOME/user-dirs.dirs
(XDG_DOCUMENTS_DIR="$HOME/Dokumente": "$HOME/..." or an absolute path, backslash
escapes, the last line wins), else $HOME/Desktop, Documents, Downloads, Pictures,
Music, Videos. macOS and iOS: $HOME/Desktop, Documents, Downloads, Pictures, Music,
Movies (on iOS inside the app's container). Browser and Android: "/documents" of the virtual files for
DIR_DOCUMENTS, None for the others.
log_dir() -> Option<String> the base folder of logs: Linux $XDG_STATE_HOME (absolute)
or $HOME/.local/state; Windows %LOCALAPPDATA% (like cache_dir); macOS and iOS
~/Library/Logs; the browser /data.
vfs::app_dir(APP_LOG) adds the app's own folder (logs://).
user_dir_scheme(kind) -> Option<&str> the vfs scheme of a user folder ("documents" ..)
The paths have '/' separators and no trailing slash, like config_dir; the folders need
not exist. user-dirs.dirs is a file of the platform (read unchecked).
/// user_dir: the desktop
DIR_DESKTOP: u32 = 0
/// user_dir: the documents
DIR_DOCUMENTS: u32 = 1
/// user_dir: the downloads of the browser
DIR_DOWNLOADS: u32 = 2
/// user_dir: pictures and photos
DIR_PICTURES: u32 = 3
/// user_dir: music
DIR_MUSIC: u32 = 4
/// user_dir: videos
DIR_VIDEOS: u32 = 5
/// the number of DIR_* kinds
DIR_COUNT: u32 = 6
fn user_dir_scheme(kind: u32) -> Option<&'static str>the vfs scheme of a user folder: "desktop", "documents", "downloads", "pictures", "music", "videos" (None for another kind)fn user_dir(kind: u32) -> Option<String>the user's folder of kind DIR_* (None: unknown kind, or none on this system)fn log_dir() -> Option<String>(Windows) the base folder of logs: %LOCALAPPDATA% (vfs::app_dir(APP_LOG) = <it>/<app>/Logs)fn log_dir() -> Option<String>(Linux) the base folder of logs: $XDG_STATE_HOME (absolute), else $HOME/.local/state (vfs::app_dir(APP_LOG) = <it>/<app>)fn log_dir() -> Option<String>(Apple) the base folder of logs: ~/Library/Logs (vfs::app_dir(APP_LOG) = <it>/<app>)fn log_dir() -> Option<String>the base folder of logs: the virtual /data (vfs::app_dir(APP_LOG) = /data/<app>/Logs)