Skip to main content

Module dirs

Module dirs 

Source
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.
SystemEnv
Inputs from the current process and filesystem.

Enums§

PathsError
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 (pass SystemEnv for the process environment, or a test double). Unset or empty values return None; absolute values are preserved verbatim. A relative value is an error naming variable, 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.