Expand description
Absolute user directories shared by CortexKit tools.
Unix (including macOS) uses the XDG layout, not ~/Library: absolute,
non-empty XDG values win, then the user’s home directory supplies the default.
Windows also honors XDG overrides, but otherwise uses roaming APPDATA for
config and local LOCALAPPDATA for data, state, and cache. Large databases
should not roam with a domain profile.
§Existing Windows installations
cortexkit_data_dir preserves an existing APPDATA/cortexkit directory
when the local cortexkit directory does not exist. An XDG data override
disables this legacy lookup. No files are moved, merged, or created. The run
directory follows the selected data directory. Without a legacy installation,
Windows uses local data, unlike older daemons that always used roaming data.
§Joining paths
Paths are assembled with Path::join or PathBuf::push, never by adding
slash-delimited strings. Hard-coded / produces mixed separators on Windows.
A path below a regular file fails with “not a directory” on Unix but can fail
with “not found” on Windows; treating NotFound as “absent” can therefore
silently skip that path. Resolution does not assert that a directory exists
or is writable; callers must still handle filesystem errors when opening it.
Structs§
- Dirs
- A resolver borrowing injectable inputs. Construct it with
with_env. - System
Env - Inputs from the current process and filesystem.
Enums§
- Paths
Error - A path could not be resolved without an unsafe relative fallback.
Traits§
- EnvSource
- Environment and filesystem inputs used by a directory resolver.
Functions§
- cache_
home - Resolve using the process environment; see
Dirs::cache_home. - config_
home - Resolve using the process environment; see
Dirs::config_home. - connection_
file_ candidates - Discover connection files using process inputs; see
Dirs::connection_file_candidates. - cortexkit_
cache_ dir - Resolve using the process environment; see
Dirs::cortexkit_cache_dir. - cortexkit_
config_ dir - Resolve using the process environment; see
Dirs::cortexkit_config_dir. - cortexkit_
data_ dir - Resolve using the process environment; see
Dirs::cortexkit_data_dir. - cortexkit_
run_ dir - Resolve using the process environment; see
Dirs::cortexkit_run_dir. - cortexkit_
state_ dir - Resolve using the process environment; see
Dirs::cortexkit_state_dir. - data_
home - Resolve using the process environment; see
Dirs::data_home. - env_
absolute_ path - Read a path-valued variable, such as an application’s own home override, from
env(passSystemEnvfor the process environment, or a test double). Unset or empty values returnNone; absolute values are preserved verbatim. A relative value is an error namingvariable, unlike XDG directory resolution, which ignores relative overrides and tries the home-directory fallback. - home
- Resolve using the process environment; see
Dirs::home. - state_
home - Resolve using the process environment; see
Dirs::state_home. - with_
env - Resolve directories using the supplied inputs on the current platform.
- xdg_
data_ home - Resolve using the process environment; see
Dirs::xdg_data_home.