Return the XDG state path for a driver's sandbox JWT token file. The resulting path is `$XDG_STATE_HOME/openshell/ [/ ]/ /sandbox.jwt`. `driver_subdir` is driver-specific, e.g. `"docker-sandbox-tokens"` or `"podman-sandbox-tokens"`. When `namespace` is `Some`, it is appended as an additional path component (with `/` and `\` replaced by `-`). # Errors Returns
(
driver_subdir: &str,
namespace: Option<&str>,
sandbox_id: &str,
)
| 83 | /// # Errors |
| 84 | /// Returns an error if the XDG state directory cannot be resolved. |
| 85 | pub fn sandbox_token_path( |
| 86 | driver_subdir: &str, |
| 87 | namespace: Option<&str>, |
| 88 | sandbox_id: &str, |
| 89 | ) -> miette::Result<PathBuf> { |
| 90 | let mut path = crate::paths::xdg_state_dir()? |
| 91 | .join("openshell") |
| 92 | .join(driver_subdir); |
| 93 | if let Some(ns) = namespace { |
| 94 | path = path.join(ns.replace(['/', '\\'], "-")); |
| 95 | } |
| 96 | Ok(path.join(sandbox_id).join("sandbox.jwt")) |
| 97 | } |
| 98 | |
| 99 | /// Build a [`GetCapabilitiesResponse`] from the common driver capability fields. |
| 100 | /// |
no test coverage detected