Skip to main content

cache_directory

Function cache_directory 

Source
pub fn cache_directory(environment: &[(OsString, OsString)]) -> Option<PathBuf>
Expand description

What: The directory that holds the cache files: cli-git under XDG_CACHE_HOME, or under .cache in the home directory. Why: The injected environment decides the location, never a fixed path; a relative XDG_CACHE_HOME is ignored as the XDG rules say.

In TS you’d write (pseudocode):

const base = isAbsolute(env.XDG_CACHE_HOME ?? '') ? env.XDG_CACHE_HOME : env.HOME && join(env.HOME, '.cache');