Function mkdir
fn mkdir<P: ?Sized + NixPath>(path: &P, mode: Mode) -> Result<()>
Creates new directory path with access rights mode. (see mkdir(2))
Errors
There are several situations where mkdir might fail:
- current user has insufficient rights in the parent directory
- the path already exists
- the path name is too long (longer than
PATH_MAX, usually 4096 on linux, 1024 on OS X)
Example
use unistd;
use stat;
use tempdir;
let tmp_dir1 = tempdir.unwrap;
let tmp_dir2 = tmp_dir1.path.join;
// create new directory and give read, write and execute rights to the owner
match mkdir