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
AGPM_CACHE_DIRenvironment variable (if set)- Platform-specific cache directory:
- Windows:
%LOCALAPPDATA%\agpm\cache - macOS/Linux:
~/.agpm/cache
- Windows:
§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