pub fn records_state_dir(
workspace_root: &Utf8Path,
) -> Result<Utf8PathBuf, StateDirError>Expand description
Returns the platform-specific state directory for nextest records for a workspace.
If the NEXTEST_STATE_DIR environment variable is set, uses that as the base
directory. Otherwise, uses the platform-specific default:
- Linux, macOS, and other Unix:
$XDG_STATE_HOME/nextest/projects/<encoded-workspace>/records/or~/.local/state/nextest/projects/<encoded-workspace>/records/ - Windows:
%LOCALAPPDATA%\nextest\projects\<encoded-workspace>\records\(Windows has no state directory concept, so falls back to cache directory.)
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 state directory as accessing it via the real path.
§Migration from cache to state directory
On first access after upgrading, this function automatically migrates the
entire ~/.cache/nextest/ directory (nextest <= 0.9.125) to
~/.local/state/nextest/ if the old location exists and the new one does
not. This is a one-time migration.
Returns an error if:
- The platform state directory cannot be determined.
- The workspace path cannot be canonicalized (e.g., doesn’t exist).
- Any path is not valid UTF-8.