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

Function last_sandbox_path_layout

crates/openshell-bootstrap/src/paths.rs:288–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

286 #[test]
287 #[allow(unsafe_code)]
288 fn last_sandbox_path_layout() {
289 let _guard = crate::XDG_TEST_LOCK
290 .lock()
291 .unwrap_or_else(std::sync::PoisonError::into_inner);
292 let tmp = tempfile::tempdir().unwrap();
293 let orig = std::env::var("XDG_CONFIG_HOME").ok();
294 unsafe {
295 std::env::set_var("XDG_CONFIG_HOME", tmp.path());
296 }
297 let path = last_sandbox_path("my-gateway").unwrap();
298 assert!(
299 path.ends_with("openshell/gateways/my-gateway/last_sandbox"),
300 "unexpected path: {path:?}"
301 );
302 unsafe {
303 match orig {
304 Some(v) => std::env::set_var("XDG_CONFIG_HOME", v),
305 None => std::env::remove_var("XDG_CONFIG_HOME"),
306 }
307 }
308 }
309
310 #[allow(unsafe_code)]
311 #[test]

Callers

nothing calls this directly

Calls 2

last_sandbox_pathFunction · 0.85
pathMethod · 0.80

Tested by

no test coverage detected