[−][src]Trait openat_ext::OpenatDirExt
Helper functions for openat::Dir
Required methods
fn open_file_optional<P: AsPath>(&self, p: P) -> Result<Option<File>>
Checking for nonexistent files (ENOENT) is by far the most common case of inspecting error
codes in Unix. Rust has a nice Option<> type, so this helper makes use of it and returns Ok(None)
for nonexistent files. All other errors are Err, and extant files are Ok(Some<file>))
of course.
fn sub_dir_optional<P: AsPath>(&self, p: P) -> Result<Option<Dir>>
Like open_file_optional() except opens a directory via openat::dir::sub_dir.
fn get_file_type(&self, e: &Entry) -> Result<SimpleType>
On modern filesystems the directory entry contains the type; if available,
return it. Otherwise invoke stat().
fn exists<P: AsPath>(&self, p: P) -> Result<bool>
Returns true iff file exists (may be a directory or symlink). Symbolic links are not followed.
fn ensure_dir<P: AsPath>(&self, p: P, mode: mode_t) -> Result<()>
Create a directory but don't error if it already exists.