//! Shared path resolution for the `mcptest conformance` family
//! (WOR-945).

use std::path::PathBuf;

/// Resolve the XDG user cache directory for the conformance corpus.
///
/// Returns `Some` when an `etcetera` resolution succeeds, `None`
/// when the platform cannot resolve a cache dir (a rare sandboxed
/// case). The returned path is the dir that holds per-spec-version
/// subdirectories; callers append `<spec-version>/` themselves.
pub fn user_cache_dir() -> Option<PathBuf> {
    use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};
    let base = choose_base_strategy().ok()?;
    Some(base.cache_dir().join("mcptest").join("conformance"))
}
