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

Function user_gateway_dir_layout

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

Source from the content-addressed store, hash-verified

196 #[test]
197 #[allow(unsafe_code)]
198 fn user_gateway_dir_layout() {
199 let _guard = crate::XDG_TEST_LOCK
200 .lock()
201 .unwrap_or_else(std::sync::PoisonError::into_inner);
202 let tmp = tempfile::tempdir().unwrap();
203 let orig = std::env::var("XDG_CONFIG_HOME").ok();
204 unsafe {
205 std::env::set_var("XDG_CONFIG_HOME", tmp.path());
206 }
207 assert_eq!(
208 user_gateway_dir("my-gateway").unwrap(),
209 tmp.path().join("openshell/gateways/my-gateway")
210 );
211 unsafe {
212 match orig {
213 Some(v) => std::env::set_var("XDG_CONFIG_HOME", v),
214 None => std::env::remove_var("XDG_CONFIG_HOME"),
215 }
216 }
217 }
218
219 #[test]
220 #[allow(unsafe_code)]

Callers

nothing calls this directly

Calls 1

pathMethod · 0.80

Tested by

no test coverage detected