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

Function system_gateway_dir_layout

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

Source from the content-addressed store, hash-verified

240 #[test]
241 #[allow(unsafe_code)]
242 fn system_gateway_dir_layout() {
243 let _guard = crate::XDG_TEST_LOCK
244 .lock()
245 .unwrap_or_else(std::sync::PoisonError::into_inner);
246 let tmp = tempfile::tempdir().unwrap();
247 let override_dir = tmp.path().join("openshell-system");
248 let orig_sys = std::env::var(SYSTEM_GATEWAY_DIR_ENV).ok();
249 unsafe {
250 std::env::set_var(SYSTEM_GATEWAY_DIR_ENV, &override_dir);
251 }
252 assert_eq!(
253 system_gateway_dir("my-gateway").unwrap(),
254 override_dir.join("gateways/my-gateway")
255 );
256 unsafe {
257 match orig_sys {
258 Some(v) => std::env::set_var(SYSTEM_GATEWAY_DIR_ENV, v),
259 None => std::env::remove_var(SYSTEM_GATEWAY_DIR_ENV),
260 }
261 }
262 }
263
264 #[test]
265 #[allow(unsafe_code)]

Callers

nothing calls this directly

Calls 1

pathMethod · 0.80

Tested by

no test coverage detected