Expand description
Where per-user data, configuration, state, cache and runtime files live.
AppPaths::for_app gives an app its data, config, cache, state and runtime
locations, the user’s folders, the workspace and the font catalog, on every
target; the functions here are the same base directories for code without an app.
Modules§
- desktop_
service - Where a desktop’s own workspace service kept its state, before the device’s daemon kept its person’s workspaces: what the session hands over once, and what root reads at sign-in to tell the daemon that the session is about to.
- login
- Whether this process runs inside a Tilo login, and where that login’s compositor
publishes its endpoints: the private
SESSION_DIRunder the login’s runtime directory. - session
- Who the app runs as and on what: the login’s account and host names, and whether a desktop session is there to show capture and call UI.
- xdg
Structs§
- AppDirs
- One app’s subdirectories of the per-user base directories, e.g.
AppDirs::new("tilo-chat").data()is~/.local/share/tilo-chaton Linux. - AppPaths
- Where one app keeps its files, the same API on every target.
- InvalidV
Path - Profile
Scope - Keeps a thread’s per-user folders below one root until it is dropped:
see
scope_profile. - VPath
- A relative path inside a
VirtualRootor below a native location:/-separated components, none of them empty,.or... The empty path is the root itself.
Enums§
- Availability
- Feature
- Location
- Where something lives. Native targets give paths; the web gives virtual roots, and so does a native process that has no home directory, whose storage then lasts only as long as the process.
- UserDir
- One of the user’s well-known content directories (Documents, Downloads, …).
- Virtual
Root
Constants§
- APPS_
DATA_ DIR_ ENV - Names the device’s store of apps and the runtimes they run on instead of its default directory.
- DEFAULT_
PROFILE - The browser profile an app’s web storage belongs to unless the host
chose another with
set_default_profile, or a caller withAppPaths::with_profile. - TRUSTED_
IDENTITIES - The file a Tilo Linux session writes the people and devices it certifies to: what an app showing who a file is shared with names them from.
- WORKSPACE_
MOUNT - Where a Tilo Linux session mounts the collaborative workspace, and the
root every member’s documents name workspace files under, whatever
this device mounts.
AppPaths::workspace_rootsays whether (and where) this process has one mounted. - WORKSPACE_
TREES_ DIR - The directory, at the root of the device’s files, that holds one tree per
workspace:
<files>/.workspaces/<workspace id>. The device’s files are one namespace (fsserves one per device); a workspace’s own files are the tree under its id, so its access checks (FsPathgrants, which scope by path prefix) cover each tree as they cover any folder.
Functions§
- audio_
dir - availability
- available
- cache_
dir - The platform’s per-user cache directory:
xdg::cache_homeon Linux and other Unix,~/Library/Cacheson macOS,%LOCALAPPDATA%on Windows. - config_
dir - The platform’s per-user configuration directory:
xdg::config_homeon Linux and other Unix,~/Library/Application Supporton macOS,%APPDATA%on Windows. - data_
dir - The platform’s per-user data directory:
xdg::data_homeon Linux and other Unix,~/Library/Application Supporton macOS,%APPDATA%on Windows. - data_
local_ dir - The platform’s per-user local (non-roaming) data directory:
xdg::data_homeon Linux and other Unix,~/Library/Application Supporton macOS,%LOCALAPPDATA%on Windows. - default_
profile - desktop_
dir - device_
data_ dir - The device’s own store of apps and the runtimes they run on:
APPS_DATA_DIR_ENVwhen it names an absolute path, else the platform data directory’stilo-apps. - document_
dir - download_
dir - env_dir
$nameas a directory, following the XDG rule for every base-directory variable: honoured only when set, non-empty and absolute.- home
- The user’s home directory:
$HOMEwhen set and non-empty, the account database’s entry when$HOMEis unset (on Unix), andNonefor an empty$HOME— an empty value names no directory, and resolving relative to the working directory would scatter state wherever the process started. On Windows it is the profile known folder, never an environment variable. - is_
workspace_ tree_ id - language_
of - The language a locale names, as a language pack is named: its language
subtag, lower case (
deofde,de-DE,de_DE.UTF-8@euro). One pack holds a language’s catalogues whatever region, encoding or modifier a locale adds, so a choice, the pack’s directory and its package id meet at this one name. Empty when no language is named. - language_
packs_ dir - locale_
tag - The BCP 47 tag a locale names: the POSIX
de_DE.UTF-8@euro, theLANGUAGElistde_AT:en_USand the BCP 47de-DEall namede-DE. The encoding and the modifier name no language, a list’s first entry is the language, and a tag spells the_a POSIX locale uses as-. - matching
- The position in
candidates(language tags, in the order the caller prefers them) of the one a reader oflocalereads best: their own tag (de-DEforde_DE.UTF-8), else another region of their language (de-DEforde-AT).Nonewhen neither is there orlocalenames no language. This is the one rule for which tag a reader gets, so every catalogue, name and window picks the same one. - memory_
temp_ dir - A temporary directory kept in memory, where the platform has one
(
/dev/shmon Linux): for scratch data that is synced like a person’s but deleted moments later (a test’s profile), whose syncs then cost nothing instead of waiting on a shared disk.Noneelsewhere. - names_
language - Whether
tagnames a language:C,POSIX,C.UTF-8and an empty value name none, so their text is read untranslated. - picture_
dir - profile_
root - The per-user Tilo profile root:
$XDG_CONFIG_HOME/tilo, else$HOME/.config/tiloon Linux and other Unix, the platform’s configuration directory elsewhere. - runtime_
dir - The per-login runtime directory:
xdg::runtime_diron Linux and other Unix, the per-user$TMPDIRon macOS when it is absolute; Windows defines none. - runtime_
publishers - The runtime publishers this device accepts, one hex Ed25519 key per line,
#comments: the list the system ships beside the code that reads it. A Linux image ships it in/etc/tilo; on a Mac it is in the resources of the Tilo.app whose executable is running, sealed by the app’s signature as that executable is. An executable outside an app bundle reads the image’s path, which a Mac does not have, so it trusts no runtime. - scope_
profile - From now until the guard drops, this thread’s home is
root:home, the per-user base folders,env_dirof the XDG variables andAppPaths::for_appall resolve below it, whatever the process environment says, and no workspace is mounted. A host that runs a member (an agent) on its own thread gives it a profile apart from the host user’s this way. Threads the scoped thread starts do not inherit it. - scoped_
profile - set_
default_ profile - Make
profilethe oneAppPaths::for_appresolves web storage in, for the rest of the process (on the web, the page). A browser host calls this once, with the profile it mounts, before any app resolves its paths. - state_
dir - The platform’s per-user state directory:
xdg::state_homeon Linux and other Unix,~/Library/Application Supporton macOS (which keeps state beside data),%LOCALAPPDATA%on Windows: state belongs to this computer, and what roams with the account (%APPDATA%) would carry it to others. - system_
font_ dirs - Directories the system and the user install fonts into, most general
first, whether or not they exist: the system font trees on Linux and
other Unix (not the user’s own),
/System/Library/Fonts,/Library/Fontsand~/Library/Fontson macOS, the Windows font folder, and none on the web. For code that reads font files itself (a document renderer’s fallback fonts, a confined helper’s read grant). - temp_
dir - The system’s shared temporary directory (
$TMPDIRor/tmp,%TEMP%), andNonewhere there is no native file system (the web), wherestd::env::temp_dirpanics instead. For scratch files that must have a native path; an app’s own scratch space isAppPaths::runtime. - unscoped
- var
- The environment variable
name, as this process’s profile scopes it: a location variable resolves below the profile root a test or a stack lent this process, and any other is read as the process has it. - video_
dir - workspace_
root - workspace_
tree - The tree of the workspace
id’s own files under the device’s files atfiles:WORKSPACE_TREES_DIR/<id>.Nonefor an id that is not one path component of[A-Za-z0-9_-], 1 to 128 bytes, so no id names a directory outside its own tree.