records_cache_dir

Function records_cache_dir 

Source
pub fn records_cache_dir(
    workspace_root: &Utf8Path,
) -> Result<Utf8PathBuf, CacheDirError>
Expand description

Returns the platform-specific cache directory for nextest records for a workspace.

If the NEXTEST_CACHE_DIR environment variable is set, uses that as the base cache directory. Otherwise, uses the platform-specific default:

  • Linux: $XDG_CACHE_HOME/nextest/projects/<encoded-workspace>/records/ or ~/.cache/nextest/projects/<encoded-workspace>/records/
  • macOS: ~/Library/Caches/nextest/projects/<encoded-workspace>/records/
  • Windows: %LOCALAPPDATA%\nextest\cache\projects\<encoded-workspace>\records\

The workspace root is canonicalized (symlinks resolved) before being encoded using encode_workspace_path to produce a directory-safe, bijective representation. This ensures that accessing a workspace via a symlink produces the same cache directory as accessing it via the real path.

Returns an error if:

  • The platform cache directory cannot be determined
  • The workspace path cannot be canonicalized (e.g., doesn’t exist)
  • Any path is not valid UTF-8