[][src]Function dia_args::paths::handle_path

pub fn handle_path<P>(path: P, kind: PathKind, option: TakeOption) -> Result<P> where
    P: AsRef<Path>, 

Handles path

This function verifies path kind and handles option. New directory or new file will be made if necessary. On success, it returns the input path.

Examples

use dia_args::paths::{self, PathKind, TakeOption};

assert_eq!(
    paths::handle_path(file!(), PathKind::File, TakeOption::MustExist)?,
    file!(),
);