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

Function xdg_state_dir

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

Resolve the XDG state base directory. Returns `$XDG_STATE_HOME` if set, otherwise `$HOME/.local/state`.

()

Source from the content-addressed store, hash-verified

35///
36/// Returns `$XDG_STATE_HOME` if set, otherwise `$HOME/.local/state`.
37pub fn xdg_state_dir() -> Result<PathBuf> {
38 if let Ok(path) = std::env::var("XDG_STATE_HOME") {
39 return Ok(PathBuf::from(path));
40 }
41 let home = std::env::var("HOME")
42 .into_diagnostic()
43 .wrap_err("HOME is not set")?;
44 Ok(PathBuf::from(home).join(".local").join("state"))
45}
46
47/// The top-level `OpenShell` state directory: `$XDG_STATE_HOME/openshell/`.
48pub fn openshell_state_dir() -> Result<PathBuf> {

Callers 2

sandbox_token_pathFunction · 0.85
openshell_state_dirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected