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

Function set_dir_owner_only

crates/openshell-core/src/paths.rs:81–92  ·  view source on GitHub ↗

Set a directory to owner-only access (`0o700`) on Unix. No-op on non-Unix platforms.

(path: &Path)

Source from the content-addressed store, hash-verified

79///
80/// No-op on non-Unix platforms.
81pub fn set_dir_owner_only(path: &Path) -> Result<()> {
82 #[cfg(unix)]
83 {
84 use std::os::unix::fs::PermissionsExt;
85 std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700))
86 .into_diagnostic()
87 .wrap_err_with(|| format!("failed to set permissions on {}", path.display()))?;
88 }
89 #[cfg(not(unix))]
90 let _ = path;
91 Ok(())
92}
93
94/// Set a file to owner-only read/write (`0o600`) on Unix.
95///

Callers 1

create_dir_restrictedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected