Skip to main content

check_path

Function check_path 

Source
pub fn check_path<S>(target: S) -> Result<String, IOError>
where S: Into<String>,
Expand description

检查路径是否合法 接受一个路径参数,可以是绝对路径也可以是一个相对路径 若路径不存在则抛出错误 InvalidPath,存在则返回当前路径的绝对路径

§Examples

use arui_core::utils::check_path;

let valid = check_path('.');
println!("{}", valid.unwrap());

let invalid = check_path("/not_exist");
println!("{}", invalid.unwrap_err());