Expand description
The user’s directories, resolved in one place (sandboxed in tests).
Where scope keeps the user’s files: one folder, $SCOPE_BCA_HOME, else
~/.scope-bca.
<home>/config.yaml venues/ data/ (address book, tokens)
state/ (session, history, tui-events, migration log, daemon files)This module is the only place that knows the layout. Code calls these
functions 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) every path is under a sandbox for each process,
never the real home, and SCOPE_BCA_HOME is ignored. Tests that wrote
the real folders replaced a user’s API keys, address book and token
aliases with test data (#98).
Modules§
- migration
- Copy the user’s files from the old locations into the scope home, once.
Constants§
- HOME_
DIR_ NAME - The scope folder’s name in the user’s home.
- HOME_
VAR - The environment variable that moves the whole scope folder.
- 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_
file <home>/config.yaml.- data_
dir <home>/data: what scope keeps for the user.- home
- The scope folder:
$SCOPE_BCA_HOME, else~/.scope-bca. - home_
from - The root for an override and a user home. An empty override is no override; with no user home the folder is relative.
- state_
dir <home>/state: session, history and logs; safe to delete.- user_
home - The user’s home folder (for
~in paths the user types). - venues_
dir <home>/venues: the user’s venue descriptors.- watchlists_
dir <home>/watchlists: the user’s saved watchlists (#47).