Skip to main content

create_dir_all_with_mode

Function create_dir_all_with_mode 

Source
pub fn create_dir_all_with_mode<P: AsRef<Path>>(
    path: P,
    owner: u32,
    mode: Mode,
) -> Result<(), MkdirWithModeError>
Expand description

Creates the specified directory and all parent directories with the specified mode. Ensures that the directory has been created with the correct mode and that the owner of the directory is the owner that has been specified

§Example

use libcontainer::utils::create_dir_all_with_mode;
use nix::sys::stat::Mode;
use std::path::Path;

let path = Path::new("/tmp/youki");
create_dir_all_with_mode(&path, 1000, Mode::S_IRWXU).unwrap();
assert!(path.exists())