Skip to main content

resolve_root

Function resolve_root 

Source
pub fn resolve_root(uid: u32, fallback: Option<PathBuf>) -> Option<PathBuf>
Expand description

Resolve the cache root, or None when no safe location can be established. Callers MUST treat None as a refusal rather than substituting a guess: a shared world-writable fallback is what this function exists to prevent.

Prefers $XDG_CACHE_HOME, then ~/.cache, both of which are already user-private. Only an absolute env-derived path is trusted, because an empty or relative one would resolve against the current directory, which the caller does not control. fallback supplies the last resort (the runtime passes its 0700 per-uid directory; a caller with none passes None).