MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / xdg_data_dir

Function xdg_data_dir

crates/openshell-core/src/paths.rs:55–63  ·  view source on GitHub ↗

Resolve the XDG data base directory. Returns `$XDG_DATA_HOME` if set, otherwise `$HOME/.local/share`.

()

Source from the content-addressed store, hash-verified

53///
54/// Returns `$XDG_DATA_HOME` if set, otherwise `$HOME/.local/share`.
55pub fn xdg_data_dir() -> Result<PathBuf> {
56 if let Ok(path) = std::env::var("XDG_DATA_HOME") {
57 return Ok(PathBuf::from(path));
58 }
59 let home = std::env::var("HOME")
60 .into_diagnostic()
61 .wrap_err("HOME is not set")?;
62 Ok(PathBuf::from(home).join(".local").join("share"))
63}
64
65/// Create a directory (and parents) with owner-only permissions (`0o700`) on
66/// Unix. On non-Unix platforms, falls back to default permissions.

Callers 3

supervisor_cache_pathFunction · 0.85
runtime_cache_dirFunction · 0.85
runtime_cache_baseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected