Skip to main content

cache_path

Function cache_path 

Source
pub fn cache_path(source: &Path) -> PathBuf
Expand description

Returns the cache file path for a given source file.

Resolution order:

  1. If BEANCOUNT_LOAD_CACHE_FILENAME is set, substitute {filename} with the source basename and resolve relative paths against the source dir.
  2. Otherwise, default to a hidden dotfile alongside the source via default_cache_path: path/to/main.beancountpath/to/.main.beancount.cache.

The dotfile prefix matches Python beancount’s .{filename}.picklecache convention, so the cache stays out of the way of ls and most file explorers without breaking from the established beancount ecosystem behavior. See issue #939.

This function reads process env. Tests that need a deterministic path regardless of the caller’s environment should use default_cache_path directly.