Expand description
Per-profile state isolation driven by the MIMICK_PROFILE env var.
When unset (the default), every state directory uses the literal
mimick segment under the user’s XDG config / data / cache roots.
When set to e.g. dev, the segment becomes mimick-dev, isolating
config, the sharded SyncIndex, retries, and the thumbnail cache from
the default profile.
Names are restricted to [A-Za-z][A-Za-z0-9_-]{0,31} so they remain valid
both as filesystem path segments (no traversal) and as D-Bus / GTK
application-id segments (must start with a letter). Invalid values are
logged and ignored.
Constants§
- MAX_
PROFILE_ 🔒LEN - Maximum character length of a valid profile name segment.
- PROFILE_
ENV_ 🔒VAR - Environment variable key driving profile isolation.
Statics§
- DIR_
SEGMENT 🔒 - Cached directory path segment mapped from environment.
- PROFILE 🔒
- Cached profile name parsed from environment.
Functions§
- application_
id - GTK / D-Bus application id. Varies by profile so multiple profiles can
run as independent GTK instances. Always remains a valid D-Bus name
because
name()is sanitised to start with a letter. - cache_
dir - Resolve user’s local cache directory parent based on profile.
- config_
dir - Resolve user’s local configuration directory parent based on profile.
- data_
dir - Resolve user’s local data directory parent based on profile.
- dir_
segment - Directory segment to use inside
dirs::*_dir()paths. - keyring_
account - Value for the keyring
accountattribute, scoping the API key per profile so switching profiles doesn’t overwrite the default’s secret. The default profile keeps the historical"api_key"value so existing installations continue to find their stored key. - name
- Active profile name, or
Nonewhen the default profile is in use. - profile 🔒
- Helper to retrieve the current profile string, parsing and caching it once.
- sanitise 🔒
- Validate that a profile name is safe for filesystem and D-Bus usage.