get_cache_dir

Function get_cache_dir 

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

Get the cache directory for AGPM.

Returns the directory where AGPM stores cached Git repositories and temporary files. The location follows platform conventions and can be overridden with environment variables.

§Location Priority

  1. AGPM_CACHE_DIR environment variable (if set)
  2. Platform-specific cache directory:
    • Windows: %LOCALAPPDATA%\agpm\cache
    • macOS/Linux: ~/.agpm/cache

§Directory Creation

The directory is automatically created if it doesn’t exist.

§Examples

use agpm_cli::config::get_cache_dir;

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

§Errors

Returns an error if:

  • The system cache directory cannot be determined
  • The cache directory cannot be created
  • Insufficient permissions for directory creation