Skip to main content

Module paths

Module paths 

Source
Expand description

The user’s directories, resolved in one place (sandboxed in tests). The user’s directories, resolved in one place.

Every file scope keeps for the user (config, address book, token aliases, session, journal, venues) is found through these functions. Code calls them instead of dirs::* (clippy’s disallowed-methods enforces this).

In test builds (cfg(test) or the test-support feature, which every test crate turns on) they resolve under a sandbox directory for each process, never the real home. Tests that wrote the real directories replaced a user’s API keys, address book and token aliases with test data.

Constants§

TEST_HOME_VAR
In test builds, the environment variable that moves the sandbox, for a test that needs a home it controls (for example one that cannot be written).

Functions§

config_dir
The platform’s config directory (for example ~/Library/Application Support on macOS).
data_dir
The platform’s data directory (for example ~/Library/Application Support on macOS).
home_dir
The home directory.