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

Function split_sandbox_path

crates/openshell-cli/src/ssh.rs:807–813  ·  view source on GitHub ↗

Split a sandbox path into (`parent_directory`, basename). Examples: `"/sandbox/.bashrc"` -> `("/sandbox", ".bashrc")` `"/sandbox/sub/file"` -> `("/sandbox/sub", "file")` `"file.txt"` -> `(".", "file.txt")`

(path: &str)

Source from the content-addressed store, hash-verified

805/// `"/sandbox/sub/file"` -> `("/sandbox/sub", "file")`
806/// `"file.txt"` -> `(".", "file.txt")`
807fn split_sandbox_path(path: &str) -> (&str, &str) {
808 match path.rfind('/') {
809 Some(0) => ("/", &path[1..]),
810 Some(pos) => (&path[..pos], &path[pos + 1..]),
811 None => (".", path),
812 }
813}
814
815/// Writable root inside every sandbox. Used as the boundary for path-traversal
816/// checks on sandbox-side source paths in download flows.

Callers 2

sandbox_sync_upFunction · 0.85
sandbox_sync_down_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected