get_cache_dir

Function get_cache_dir 

Source
pub fn get_cache_dir() -> Result<PathBuf>
Expand description

Returns the platform-specific cache directory for CCPM.

This function returns the appropriate cache directory following platform conventions and standards (XDG Base Directory on Linux, standard locations on Windows and macOS).

§Returns

The cache directory path ({cache_dir}/ccpm), or an error if it cannot be determined

§Examples

use ccpm::utils::platform::get_cache_dir;

let cache_dir = get_cache_dir()?;
println!("CCPM cache directory: {}", cache_dir.display());

// Use for storing temporary data
let repo_cache = cache_dir.join("repositories");

§Platform Paths

  • Linux: $XDG_CACHE_HOME/ccpm or $HOME/.cache/ccpm
  • macOS: $HOME/Library/Caches/ccpm
  • Windows: %LOCALAPPDATA%\ccpm

§Standards Compliance

  • Linux: Follows XDG Base Directory Specification
  • macOS: Follows Apple File System Programming Guide
  • Windows: Follows Windows Known Folders conventions

§Use Cases

  • Storing cloned Git repositories
  • Caching downloaded resources
  • Temporary build artifacts
  • Performance optimization data

§Cleanup

Cache directories may be cleaned by system maintenance tools or user cleanup utilities. Don’t store critical data here.

§See Also