MCPcopy Create free account
hub / github.com/archlinux/alpm / from_xdg

Method from_xdg

dev-scripts/src/cache.rs:25–33  ·  view source on GitHub ↗

Creates a new [`CacheDir`] from XDG default location. Defaults to `$XDG_CACHE_HOME/alpm/testing`. If `$XDG_CACHE_HOME` is unset, falls back to `~/.cache/alpm/testing`. # Errors Returns an error if the cache directory for the current user cannot be retrieved.

()

Source from the content-addressed store, hash-verified

23 ///
24 /// Returns an error if the cache directory for the current user cannot be retrieved.
25 pub fn from_xdg() -> Result<Self, Error> {
26 let path = cache_dir()
27 .ok_or(Error::CannotGetCacheDir)?
28 .join(PROJECT_NAME)
29 .join(TESTING_DIR);
30 debug!("Using path {path:?} as cache dir.");
31
32 Ok(Self(path))
33 }
34}
35
36impl From<PathBuf> for CacheDir {

Callers

nothing calls this directly

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected