Expand description
Where an app keeps its own files: its data, cache and configuration directories, each a folder named after the app id in the place its platform sets aside for that kind of file (docs/fs.md “Where files live”). Every Day crate that stores files resolves them here, so an app’s database, documents, caches, settings file and remembered window frames sit together and apart from every other app’s.
These only resolve paths; nothing is created until something is written. Each is None where
the platform has no such directory: the web, or an Android or HarmonyOS process whose host
passed none.
Functions§
- app_id
- The app’s id,
[app] idfrom Day.toml:DAY_APP_IDfromday launch, else the valueday buildbaked in, else the executable’s name (a test binary or a barecargo run). Made safe as a single folder name. - cache_
dir - The app’s cache directory, for what it can fetch or compute again: the system may clear
it, and backups skip it. Caches on Apple platforms,
%LOCALAPPDATA%\<id>\cacheon Windows,$XDG_CACHE_HOMEon Linux, the app’s cache directory on Android and HarmonyOS.DAY_CACHE_DIRreplaces it; with onlyDAY_DATA_DIRset it is that directory’scache. - config_
dir - The app’s configuration directory, for small settings files: Application Support on
Apple platforms (whose preferences proper are the user defaults), the roaming
%APPDATA%on Windows,$XDG_CONFIG_HOMEon Linux. WithDAY_DATA_DIRset (as the Android and HarmonyOS hosts do) it is that directory’sconfig. - data_
dir - The app’s data directory, for what it cannot recreate: databases, documents, downloads
the user kept. Application Support on Apple platforms (inside the container when
sandboxed),
%LOCALAPPDATA%on Windows,$XDG_DATA_HOMEon Linux, the app’s files directory on Android and HarmonyOS.DAY_DATA_DIRreplaces it. - data_
dir_ for data_dirfor the appapp_idrather than this process’s own: a host that keeps a folder per hosted app (a day-lite superapp, a crash reporter’s store), or a tool finding where an app it launched writes. On Android and HarmonyOS, where the host’s directory is already the one app’s, the id changes nothing.